boncheolgu / tflite-rs

Apache License 2.0
116 stars 55 forks source link

Can't compile with newer versions of Rust #58

Open sheosi opened 2 years ago

sheosi commented 2 years ago

Concretely I'm on version 1.61and while trying to compile a project with tflite in there this is what I get:

Checking tflite v0.9.6 (https://github.com/boncheolgu/tflite-rs#50ed6075)
error[E0740]: unions cannot contain fields that may need dropping
   --> /home/sergio/Documentos/Voice_Assistants/precise-rs/target/debug/build/tflite-f45dcb97c94f6ca3/out/tflite_types.rs:411:13
    |
411 |             pub _M_val: _Tp,
    |             ^^^^^^^^^^^^^^^
    |
    = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type
help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped
    |
411 |             pub _M_val: std::mem::ManuallyDrop<_Tp>,
    |                         +++++++++++++++++++++++   +

For more information about this error, try `rustc --explain E0740`.
error: could not compile `tflite` due to previous error

Note that I compiled the project with older versions and this seems a problem of modern Rust with this lib.

otaviojr commented 2 years ago

+1

Marekkon5 commented 2 years ago

I've made temporary hack which works with latest Rust: https://github.com/Marekkon5/tflite-rs (master branch)

rkoopmans commented 2 years ago

+1

Sir-Photch commented 1 year ago

I've made temporary hack which works with latest Rust: https://github.com/Marekkon5/tflite-rs (master branch)

How dirty do you consider this hack to be?

Marekkon5 commented 1 year ago

@Sir-Photch it literally does a string replace on code on generated variable... The variable name can change at any time (with bindgen/tflite updates), and generally doing string replacements on code is NOT a good idea.

very very dirty.