rust/tests/ui/match/pattern-deref-miscompile.rs
2024-02-16 20:02:50 +00:00

47 lines
1.0 KiB
Rust

//@ run-pass
fn main() {
match b"." as &[u8] {
b"." if true => {},
b"." => panic!(),
b".." => panic!(),
b"" => panic!(),
_ => panic!(),
}
match b"." as &[u8] {
b"." if false => panic!(),
b"." => {},
b".." => panic!(),
b"" => panic!(),
_ => panic!(),
}
match b".." as &[u8] {
b"." if true => panic!(), // the miscompile caused this arm to be reached
b"." => panic!(),
b".." => {},
b"" => panic!(),
_ => panic!(),
}
match b".." as &[u8] {
b"." if false => panic!(),
b"." => panic!(),
b".." => {},
b"" => panic!(),
_ => panic!(),
}
match b"" as &[u8] {
b"." if true => panic!(),
b"." => panic!(),
b".." => panic!(),
b"" => {},
_ => panic!(),
}
match b"" as &[u8] {
b"." if false => panic!(),
b"." => panic!(),
b".." => panic!(),
b"" => {},
_ => panic!(),
}
}