mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 21:47:15 +03:00
add test for invalid char
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fn main() {
|
||||
assert!(std::char::from_u32(-1_i32 as u32).is_none());
|
||||
match unsafe { std::mem::transmute::<i32, char>(-1) } {
|
||||
'a' => {}, //~ERROR tried to interpret an invalid 32-bit value as a char: 4294967295
|
||||
'b' => {},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user