rust/tests/compile-fail/match_char2.rs
2018-08-24 19:18:21 +02:00

6 lines
220 B
Rust

fn main() {
assert!(std::char::from_u32(-1_i32 as u32).is_none());
let c = unsafe { std::mem::transmute::<i32, char>(-1) };
let _x = c == 'x'; //~ ERROR tried to interpret an invalid 32-bit value as a char
}