diff --git a/tests/compile-fail/match_char.rs b/tests/compile-fail/match_char.rs new file mode 100644 index 000000000000..a91c7fef6aa1 --- /dev/null +++ b/tests/compile-fail/match_char.rs @@ -0,0 +1,8 @@ +fn main() { + assert!(std::char::from_u32(-1_i32 as u32).is_none()); + match unsafe { std::mem::transmute::(-1) } { + 'a' => {}, //~ERROR tried to interpret an invalid 32-bit value as a char: 4294967295 + 'b' => {}, + _ => {}, + } +}