andrewdavidmackenzie / libproc-rs

A rust library for getting information about running processes for Mac and Linux
MIT License
58 stars 17 forks source link

macos11 nightly fails with clippy misaligned access warning #78

Closed andrewdavidmackenzie closed 2 years ago

andrewdavidmackenzie commented 2 years ago

I assume that this check will progress to stable before too long and break everything, so we will have to fix it.

Apart from disabling from the root of the crate, not sure there is a lot we can do, as this is in bindgen generated code.

Compiling libproc v0.11.1 (/Users/runner/work/libproc-rs/libproc-rs)
error: reference to packed field is unaligned
 --> /Users/runner/work/libproc-rs/libproc-rs/target/debug/build/libproc-ec97c35fbd[55](https://github.com/andrewdavidmackenzie/libproc-rs/runs/6163681943?check_suite_focus=true#step:4:55)2ca1/out/osx_libproc_bindings.rs:3:373846
  |
3 | ...state))) ; assert_eq ! (unsafe { & (* (:: std :: ptr :: null :: < searchstate > ())) . ss_union_flags as * const _ as usize } , 0usize...
  |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[deny(unaligned_references)]` on by default
  = 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)