Skip to content

Commit 8a9414a

Browse files
committed
Add a few more tests of edge cases
1 parent 8f2ce3d commit 8a9414a

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

Diff for: src/test/ui/pattern/slice-pattern-const-2.rs

+7
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,11 @@ fn main() {
2121
MAGIC_TEST => (), // this should warn
2222
_ => (),
2323
}
24+
const FOO: [u32; 1] = [4];
25+
match [99] {
26+
[0x00] => (),
27+
[4] => (),
28+
FOO => (), // this should warn
29+
_ => (),
30+
}
2431
}

Diff for: src/test/ui/pattern/slice-pattern-const-3.rs

+7
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,11 @@ fn main() {
2121
MAGIC_TEST => (), // this should warn
2222
_ => (),
2323
}
24+
const FOO: [&str; 1] = ["boo"];
25+
match ["baa"] {
26+
["0x00"] => (),
27+
["boo"] => (),
28+
FOO => (), // this should warn
29+
_ => (),
30+
}
2431
}

Diff for: src/test/ui/pattern/slice-pattern-const.rs

+23
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,27 @@ fn main() {
2121
MAGIC_TEST => (), // this should warn
2222
_ => (),
2323
}
24+
const FOO: [u8; 1] = [4];
25+
match [99] {
26+
[0x00] => (),
27+
[4] => (),
28+
FOO => (), // this should warn
29+
_ => (),
30+
}
31+
const BAR: &[u8; 1] = &[4];
32+
match &[99] {
33+
[0x00] => (),
34+
[4] => (),
35+
BAR => (), // this should warn
36+
b"a" => (),
37+
_ => (),
38+
}
39+
40+
const BOO: &[u8; 0] = &[];
41+
match &[] {
42+
[] => (),
43+
BOO => (), // this should warn
44+
b"" => (),
45+
_ => (),
46+
}
2447
}

0 commit comments

Comments
 (0)