rust/tests/compile-fail/invalid_bool.rs

5 lines
163 B
Rust
Raw Normal View History

fn main() {
2017-12-05 10:06:03 -06:00
let b = unsafe { std::mem::transmute::<u8, bool>(2) }; //~ ERROR: invalid boolean value read
if b { unreachable!() } else { unreachable!() }
}