rust/tests/compile-fail/validity/invalid_char.rs

9 lines
292 B
Rust
Raw Normal View History

fn main() {
assert!(std::char::from_u32(-1_i32 as u32).is_none());
2020-05-01 03:29:39 -05:00
let _val = match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ ERROR encountered 0xffffffff, but expected a valid unicode codepoint
'a' => {true},
'b' => {false},
_ => {true},
};
}