Closed
Description
In my "libproc-rs" project bindgen generates code that rustc stable/nightly warns will become an error in new releases.
error: reference to packed field is unaligned
--> /Users/runner/work/libproc-rs/libproc-rs/target/debug/build/libproc-16321469bc40d5c5/out/osx_libproc_bindings.rs:3:673744
|
3 | ...ze))) ; assert_eq ! (unsafe { & (* (:: std :: ptr :: null :: < proc_exitreasoninfo > ())) . eri_kcd_buf as * const _ as usize } , 24us...
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error: could not compile `libproc` due to 110 previous errors
Error: Process completed with exit code 101.
Is there any way to avoid this, or is it something that could be worked on here in bindgen to avoid in the future?
Metadata
Metadata
Assignees
Labels
No labels