rust/tests/compile-fail/invalid_bool.rs

9 lines
368 B
Rust
Raw Normal View History

// Validation makes this fail in the wrong place
// Make sure we find these even with many checks disabled.
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
fn main() {
let b = unsafe { std::mem::transmute::<u8, bool>(2) };
2020-05-01 07:43:59 -05:00
let _x = b == true; //~ ERROR interpreting an invalid 8-bit value as a bool
}