summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/invalid_bool.rs
blob: fe9bb3bed7f013e7167668d25db31864a9127ff0 (plain)
1
2
3
4
5
6
7
8
// 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

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
}