rust/tests/compile-fail/match_char.rs

9 lines
268 B
Rust
Raw Normal View History

2016-06-21 02:53:26 -05:00
fn main() {
assert!(std::char::from_u32(-1_i32 as u32).is_none());
2017-12-05 10:06:03 -06:00
match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ERROR tried to interpret an invalid 32-bit value as a char: 4294967295
'a' => {},
2016-06-21 02:53:26 -05:00
'b' => {},
_ => {},
}
}