diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/pattern/usefulness/consts-opaque.rs | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/tests/ui/pattern/usefulness/consts-opaque.rs b/tests/ui/pattern/usefulness/consts-opaque.rs index c10c6205a..27e305a39 100644 --- a/tests/ui/pattern/usefulness/consts-opaque.rs +++ b/tests/ui/pattern/usefulness/consts-opaque.rs @@ -30,15 +30,13 @@ fn main() { match FOO { FOO => {} //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` - _ => {} // should not be emitting unreachable warning - //~^ ERROR unreachable pattern + _ => {} } match FOO_REF { FOO_REF => {} //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` - Foo(_) => {} // should not be emitting unreachable warning - //~^ ERROR unreachable pattern + Foo(_) => {} } // This used to cause an ICE (https://github.com/rust-lang/rust/issues/78071) @@ -51,39 +49,31 @@ fn main() { match BAR { Bar => {} - BAR => {} // should not be emitting unreachable warning + BAR => {} //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` - //~| ERROR unreachable pattern _ => {} - //~^ ERROR unreachable pattern } match BAR { BAR => {} //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` - Bar => {} // should not be emitting unreachable warning - //~^ ERROR unreachable pattern + Bar => {} _ => {} - //~^ ERROR unreachable pattern } match BAR { BAR => {} //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` - BAR => {} // should not be emitting unreachable warning + BAR => {} //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` - //~| ERROR unreachable pattern - _ => {} // should not be emitting unreachable warning - //~^ ERROR unreachable pattern + _ => {} } match BAZ { BAZ => {} //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` - Baz::Baz1 => {} // should not be emitting unreachable warning - //~^ ERROR unreachable pattern + Baz::Baz1 => {} _ => {} - //~^ ERROR unreachable pattern } match BAZ { @@ -91,16 +81,13 @@ fn main() { BAZ => {} //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` _ => {} - //~^ ERROR unreachable pattern } match BAZ { BAZ => {} //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` - Baz::Baz2 => {} // should not be emitting unreachable warning - //~^ ERROR unreachable pattern - _ => {} // should not be emitting unreachable warning - //~^ ERROR unreachable pattern + Baz::Baz2 => {} + _ => {} } type Quux = fn(usize, usize) -> usize; @@ -108,8 +95,10 @@ fn main() { const QUUX: Quux = quux; match QUUX { - QUUX => {} - QUUX => {} + QUUX => {} //~WARN behave unpredictably + //~| previously accepted + QUUX => {} //~WARN behave unpredictably + //~| previously accepted _ => {} } @@ -118,14 +107,17 @@ fn main() { const WRAPQUUX: Wrap<Quux> = Wrap(quux); match WRAPQUUX { - WRAPQUUX => {} - WRAPQUUX => {} + WRAPQUUX => {} //~WARN behave unpredictably + //~| previously accepted + WRAPQUUX => {} //~WARN behave unpredictably + //~| previously accepted Wrap(_) => {} } match WRAPQUUX { Wrap(_) => {} - WRAPQUUX => {} + WRAPQUUX => {} //~WARN behave unpredictably + //~| previously accepted } match WRAPQUUX { @@ -134,7 +126,8 @@ fn main() { match WRAPQUUX { //~^ ERROR: non-exhaustive patterns: `Wrap(_)` not covered - WRAPQUUX => {} + WRAPQUUX => {} //~WARN behave unpredictably + //~| previously accepted } #[derive(PartialEq, Eq)] @@ -145,9 +138,11 @@ fn main() { const WHOKNOWSQUUX: WhoKnows<Quux> = WhoKnows::Yay(quux); match WHOKNOWSQUUX { - WHOKNOWSQUUX => {} + WHOKNOWSQUUX => {} //~WARN behave unpredictably + //~| previously accepted WhoKnows::Yay(_) => {} - WHOKNOWSQUUX => {} + WHOKNOWSQUUX => {} //~WARN behave unpredictably + //~| previously accepted WhoKnows::Nope => {} } } |