Move /src/test to /tests
This commit is contained in:
parent
ca855e6e42
commit
cf2dff2b1e
27592 changed files with 0 additions and 0 deletions
55
tests/ui/pattern/usefulness/match-byte-array-patterns.rs
Normal file
55
tests/ui/pattern/usefulness/match-byte-array-patterns.rs
Normal file
|
@ -0,0 +1,55 @@
|
|||
#![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
|
||||
_ => {}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue