mirror of
https://git.proxmox.com/git/rustc
synced 2026-01-01 15:34:34 +00:00
56 lines
1.1 KiB
Rust
56 lines
1.1 KiB
Rust
#![deny(unreachable_patterns)]
|
|
|
|
fn main() {
|
|
let buf = &[0, 1, 2, 3];
|
|
|
|
match buf {
|
|
b"AAAA" => {},
|
|
&[0x41, 0x41, 0x41, 0x41] => {} //~ ERROR unreachable pattern
|
|
_ => {}
|
|
}
|
|
|
|
match buf {
|
|
&[0x41, 0x41, 0x41, 0x41] => {}
|
|
b"AAAA" => {}, //~ ERROR unreachable pattern
|
|
_ => {}
|
|
}
|
|
|
|
match buf {
|
|
&[_, 0x41, 0x41, 0x41] => {},
|
|
b"AAAA" => {}, //~ ERROR unreachable pattern
|
|
_ => {}
|
|
}
|
|
|
|
match buf {
|
|
&[0x41, .., 0x41] => {}
|
|
b"AAAA" => {}, //~ ERROR unreachable pattern
|
|
_ => {}
|
|
}
|
|
|
|
let buf: &[u8] = buf;
|
|
|
|
match buf {
|
|
b"AAAA" => {},
|
|
&[0x41, 0x41, 0x41, 0x41] => {} //~ ERROR unreachable pattern
|
|
_ => {}
|
|
}
|
|
|
|
match buf {
|
|
&[0x41, 0x41, 0x41, 0x41] => {}
|
|
b"AAAA" => {}, //~ ERROR unreachable pattern
|
|
_ => {}
|
|
}
|
|
|
|
match buf {
|
|
&[_, 0x41, 0x41, 0x41] => {},
|
|
b"AAAA" => {}, //~ ERROR unreachable pattern
|
|
_ => {}
|
|
}
|
|
|
|
match buf {
|
|
&[0x41, .., 0x41] => {}
|
|
b"AAAA" => {}, //~ ERROR unreachable pattern
|
|
_ => {}
|
|
}
|
|
}
|