]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/invalid_bool.rs
Rollup merge of #101717 - Pointerbender:unsafecell-memory-layout, r=Amanieu
[rust.git] / src / tools / miri / tests / 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
6 fn main() {
7     let b = unsafe { std::mem::transmute::<u8, bool>(2) };
8     let _x = b == std::hint::black_box(true); //~ ERROR: interpreting an invalid 8-bit value as a bool
9 }