Skip to content

Commit 03f0ca0

Browse files
committed
Add test
1 parent b202532 commit 03f0ca0

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,17 @@ fn main() {
7777
(false | true, false | true) => {}
7878
}
7979
match (true, true) {
80-
(true, false) => {}
81-
(false, true) => {}
80+
(true, true) => {}
81+
(false, false) => {}
8282
(false | true, false | true) => {}
8383
}
84+
// https://github.com/rust-lang/rust/issues/76836
85+
match None {
86+
Some(false) => {}
87+
None | Some(true
88+
| false) => {} // expected unreachable warning here
89+
}
90+
8491
// A subpattern that is unreachable in all branches is overall unreachable.
8592
match (true, true) {
8693
(false, true) => {}

src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ LL | Some(0
101101
| ^
102102

103103
error: unreachable pattern
104-
--> $DIR/exhaustiveness-unreachable-pattern.rs:89:15
104+
--> $DIR/exhaustiveness-unreachable-pattern.rs:96:15
105105
|
106106
LL | | true) => {}
107107
| ^^^^
108108

109109
error: unreachable pattern
110-
--> $DIR/exhaustiveness-unreachable-pattern.rs:95:15
110+
--> $DIR/exhaustiveness-unreachable-pattern.rs:102:15
111111
|
112112
LL | | true,
113113
| ^^^^

0 commit comments

Comments
 (0)