diff --git a/src/test/ui/or-patterns/exhaustiveness-pass.rs b/src/test/ui/or-patterns/exhaustiveness-pass.rs index 5c4e239b5e39f..ce0fe6fc2a375 100644 --- a/src/test/ui/or-patterns/exhaustiveness-pass.rs +++ b/src/test/ui/or-patterns/exhaustiveness-pass.rs @@ -42,32 +42,4 @@ fn main() { ((0, 0) | (1, 0),) => {} _ => {} } - - match (0,) { - (1 - | 1,) => {} //~ ERROR unreachable - _ => {} - } - match [0; 2] { - [0 - | 0 //~ ERROR unreachable - , 0 - | 0] => {} //~ ERROR unreachable - _ => {} - } - match &[][..] { - [0] => {} - [0, _] => {} - [0, _, _] => {} - [1, ..] => {} - [1 //~ ERROR unreachable - | 2, ..] => {} - _ => {} - } - match Some(0) { - Some(0) => {} - Some(0 //~ ERROR unreachable - | 1) => {} - _ => {} - } } diff --git a/src/test/ui/or-patterns/exhaustiveness-pass.stderr b/src/test/ui/or-patterns/exhaustiveness-pass.stderr index 7ca02862b4567..1f4278c4b8098 100644 --- a/src/test/ui/or-patterns/exhaustiveness-pass.stderr +++ b/src/test/ui/or-patterns/exhaustiveness-pass.stderr @@ -1,44 +1,8 @@ -error: unreachable pattern - --> $DIR/exhaustiveness-pass.rs:48:12 - | -LL | | 1,) => {} - | ^ - | -note: lint level defined here - --> $DIR/exhaustiveness-pass.rs:4:9 - | -LL | #![deny(unreachable_patterns)] - | ^^^^^^^^^^^^^^^^^^^^ - -error: unreachable pattern - --> $DIR/exhaustiveness-pass.rs:55:15 - | -LL | | 0] => {} - | ^ - -error: unreachable pattern - --> $DIR/exhaustiveness-pass.rs:53:15 - | -LL | | 0 - | ^ - -error: unreachable pattern - --> $DIR/exhaustiveness-pass.rs:63:10 - | -LL | [1 - | ^ - -error: unreachable pattern - --> $DIR/exhaustiveness-pass.rs:69:14 - | -LL | Some(0 - | ^ - error: or-patterns are not fully implemented yet --> $DIR/exhaustiveness-pass.rs:10:10 | LL | (0 | _,) => {} | ^^^^^ -error: aborting due to 6 previous errors +error: aborting due to previous error diff --git a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs index 2cd8ca2dbac62..860c7a1bde5fb 100644 --- a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs +++ b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs @@ -48,4 +48,32 @@ fn main() { ((1..=4,),) => {}, //~ ERROR unreachable pattern _ => {}, } + + match (0,) { + (1 + | 1,) => {} //~ ERROR unreachable + _ => {} + } + match [0; 2] { + [0 + | 0 //~ ERROR unreachable + , 0 + | 0] => {} //~ ERROR unreachable + _ => {} + } + match &[][..] { + [0] => {} + [0, _] => {} + [0, _, _] => {} + [1, ..] => {} + [1 //~ ERROR unreachable + | 2, ..] => {} + _ => {} + } + match Some(0) { + Some(0) => {} + Some(0 //~ ERROR unreachable + | 1) => {} + _ => {} + } } diff --git a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr index a4d55d805c3c6..87f69a484bbbc 100644 --- a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr +++ b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr @@ -70,11 +70,41 @@ error: unreachable pattern LL | ((1..=4,),) => {}, | ^^^^^^^^^^^ +error: unreachable pattern + --> $DIR/exhaustiveness-unreachable-pattern.rs:54:12 + | +LL | | 1,) => {} + | ^ + +error: unreachable pattern + --> $DIR/exhaustiveness-unreachable-pattern.rs:61:15 + | +LL | | 0] => {} + | ^ + +error: unreachable pattern + --> $DIR/exhaustiveness-unreachable-pattern.rs:59:15 + | +LL | | 0 + | ^ + +error: unreachable pattern + --> $DIR/exhaustiveness-unreachable-pattern.rs:69:10 + | +LL | [1 + | ^ + +error: unreachable pattern + --> $DIR/exhaustiveness-unreachable-pattern.rs:75:14 + | +LL | Some(0 + | ^ + error: or-patterns are not fully implemented yet --> $DIR/exhaustiveness-unreachable-pattern.rs:10:10 | LL | (0 | _,) => {} | ^^^^^ -error: aborting due to 12 previous errors +error: aborting due to 17 previous errors