KWARC / rust-libxml

Rust wrapper for libxml2
https://crates.io/crates/libxml
MIT License
76 stars 38 forks source link

Remove tests using null pointer deref #90

Closed dginev closed 3 years ago

dginev commented 3 years ago

The recent versions of rustc are throwing warnings at some bindgen-generated tests, such as:

warning: dereferencing a null pointer
     --> src/bindings.rs:17692:15
      |
17692 |     unsafe { &(*(::std::ptr::null::<_xmlSchemaNotation>())).type_ as *const _ as usize },
      |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
      |
      = note: `#[warn(deref_nullptr)]` on by default

This PR simply comments all of those tests out, as an experimental way out. I prefer that to disabling the warning, since the technique sounds dangerous enough to not rely on in general.

dginev commented 3 years ago

I'll merge these for now and hope not having them doesn't hide some obscure problems on less used platforms. The (several screens of) undefined behavior warnings are a bit too much to keep in master.