rust/tests/compile-fail/invalid_bool.rs

8 lines
250 B
Rust
Raw Normal View History

// Validation makes this fail in the wrong place
// compile-flags: -Zmiri-disable-validation
fn main() {
let b = unsafe { std::mem::transmute::<u8, bool>(2) };
2020-03-08 17:34:54 -05:00
let _x = b == true; //~ ERROR interpreting an invalid 8-bit value as a bool: 2
}