rust/tests/compile-fail/invalid_bool.rs

10 lines
414 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
2020-09-07 04:26:24 -05:00
#![feature(test)]
fn main() {
let b = unsafe { std::mem::transmute::<u8, bool>(2) };
2020-09-07 04:26:24 -05:00
let _x = b == std::hint::black_box(true); //~ ERROR interpreting an invalid 8-bit value as a bool: 0x02
}