rust/tests/fail/invalid_bool.rs

10 lines
420 B
Rust
Raw Normal View History

// Validation makes this fail in the wrong place
// Make sure we find these even with many checks disabled.
2022-07-08 11:08:32 -05:00
//@compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
2021-04-25 09:57:48 -05:00
#![feature(bench_black_box)]
fn main() {
let b = unsafe { std::mem::transmute::<u8, bool>(2) };
let _x = b == std::hint::black_box(true); //~ ERROR: interpreting an invalid 8-bit value as a bool
}