JohnTitor / ctest2

Automatic testing of FFI bindings for Rust
https://crates.io/crates/ctest2
Apache License 2.0
22 stars 20 forks source link

offset_of! triggers the deref_nullptr lint on nightly #23

Closed sfackler closed 3 years ago

sfackler commented 3 years ago
error: dereferencing a null pointer
    --> /home/runner/work/rstack/rstack/target/aarch64-unknown-linux-gnu/debug/build/unwind-systest-b23fd082cb870172/out/all.rs:54:24
     |
54   |                     (&((*(0 as *const $ty)).$field)) as *const _ as u64
     |                        ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
...
2685 |                     same(offset_of!(unw_cursor_t, opaque),
     |                          -------------------------------- in this macro invocation
     |
     = note: `-D deref-nullptr` implied by `-D warnings`
     = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

https://github.com/sfackler/rstack/runs/2462078365?check_suite_focus=true