Skip to content

Commit

Permalink
Add a few more tests of edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Dec 10, 2018
1 parent 8f2ce3d commit 8a9414a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/test/ui/pattern/slice-pattern-const-2.rs
Expand Up @@ -21,4 +21,11 @@ fn main() {
MAGIC_TEST => (), // this should warn
_ => (),
}
const FOO: [u32; 1] = [4];
match [99] {
[0x00] => (),
[4] => (),
FOO => (), // this should warn
_ => (),
}
}
7 changes: 7 additions & 0 deletions src/test/ui/pattern/slice-pattern-const-3.rs
Expand Up @@ -21,4 +21,11 @@ fn main() {
MAGIC_TEST => (), // this should warn
_ => (),
}
const FOO: [&str; 1] = ["boo"];
match ["baa"] {
["0x00"] => (),
["boo"] => (),
FOO => (), // this should warn
_ => (),
}
}
23 changes: 23 additions & 0 deletions src/test/ui/pattern/slice-pattern-const.rs
Expand Up @@ -21,4 +21,27 @@ fn main() {
MAGIC_TEST => (), // this should warn
_ => (),
}
const FOO: [u8; 1] = [4];
match [99] {
[0x00] => (),
[4] => (),
FOO => (), // this should warn
_ => (),
}
const BAR: &[u8; 1] = &[4];
match &[99] {
[0x00] => (),
[4] => (),
BAR => (), // this should warn
b"a" => (),
_ => (),
}

const BOO: &[u8; 0] = &[];
match &[] {
[] => (),
BOO => (), // this should warn
b"" => (),
_ => (),
}
}

0 comments on commit 8a9414a

Please sign in to comment.