Static rustc_lint::builtin::INVALID_VALUE
source · pub static INVALID_VALUE: &Lint
Expand description
The invalid_value
lint detects creating a value that is not valid,
such as a null reference.
Example
unsafe {
let x: &'static i32 = std::mem::zeroed();
}
{{produces}}
Explanation
In some situations the compiler can detect that the code is creating an invalid value, which should be avoided.
In particular, this lint will check for improper use of
mem::zeroed
, mem::uninitialized
, mem::transmute
, and
MaybeUninit::assume_init
that can cause undefined behavior. The
lint should provide extra information to indicate what the problem is
and a possible solution.