]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/invalid_bool.rs
933ee91c7d4d46ca4b0bc87c8a54e8f50b1fafcc
[rust.git] / tests / compile-fail / invalid_bool.rs
1 // Validation makes this fail in the wrong place
2 // Make sure we find these even with many checks disabled.
3 // compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
4
5 fn dont_optimize<T>(x: T) -> T { x }
6
7 fn main() {
8     let b = unsafe { std::mem::transmute::<u8, bool>(2) };
9     let _x = b == dont_optimize(true); //~ ERROR interpreting an invalid 8-bit value as a bool: 0x02
10 }