rust/tests/fail/validity/invalid_char.rs
2022-07-11 11:48:56 +00:00

10 lines
299 B
Rust

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