rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

Error generation

Open topcoco opened this issue 6 months ago • 1 comments

error[E0740]: field must implement Copy or be wrapped in ManuallyDrop<...> to be used in a union --> ./open/162/generated_bindings.rs:12:5 | 12 | pub _M_val: _Tp, | ^^^^^^^^^^^^^^^ | = note: union fields must not have drop side-effects, which is currently enforced via either Copy or ManuallyDrop<...> help: wrap the field type in ManuallyDrop<...> | 12 | pub _M_val: std::mem::ManuallyDrop<_Tp>, | +++++++++++++++++++++++ +

error: aborting due to 1 previous error

For more information about this error, try rustc --explain E0740.

#[repr(C)] pub union std_vector__Temporary_value__Storage<_Tp> { pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<_Tp>>, pub _M_byte: ::std::os::raw::c_uchar, pub _M_val: _Tp, //Error generation }

#[repr(C)] pub union std_vector__Temporary_value__Storage<_Tp> { pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<_Tp>>, pub _M_byte: ::std::os::raw::c_uchar, pub _M_val: ManuallyDrop<_Tp>, //Changing it to this compilation can be passed }

topcoco avatar Jun 18 '25 15:06 topcoco

Hi, Can you provide the C or C++ header file?

boydjohnson avatar Jul 14 '25 21:07 boydjohnson