Skip to content

Commit

Permalink
Accidentally fixed #78071
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Oct 19, 2020
1 parent c4ae6c2 commit 5bfd3e7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 24 deletions.
12 changes: 7 additions & 5 deletions src/test/ui/pattern/usefulness/consts-opaque.rs
Expand Up @@ -44,11 +44,13 @@ fn main() {
//~^ ERROR unreachable pattern
}

// FIXME: this causes an ICE (https://github.com/rust-lang/rust/issues/78071)
//match FOO_REF_REF {
// FOO_REF_REF => {}
// Foo(_) => {}
//}
// This used to cause an ICE (https://github.com/rust-lang/rust/issues/78071)
match FOO_REF_REF {
FOO_REF_REF => {}
//~^ WARNING must be annotated with `#[derive(PartialEq, Eq)]`
//~| WARNING this was previously accepted by the compiler but is being phased out
Foo(_) => {}
}

match BAR {
Bar => {}
Expand Down
48 changes: 29 additions & 19 deletions src/test/ui/pattern/usefulness/consts-opaque.stderr
Expand Up @@ -28,22 +28,32 @@ error: unreachable pattern
LL | Foo(_) => {} // should not be emitting unreachable warning
| ^^^^^^

warning: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:49:9
|
LL | FOO_REF_REF => {}
| ^^^^^^^^^^^
|
= note: `#[warn(indirect_structural_match)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>

error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:55:9
--> $DIR/consts-opaque.rs:57:9
|
LL | BAR => {} // should not be emitting unreachable warning
| ^^^

error: unreachable pattern
--> $DIR/consts-opaque.rs:55:9
--> $DIR/consts-opaque.rs:57:9
|
LL | Bar => {}
| --- matches any value
LL | BAR => {} // should not be emitting unreachable warning
| ^^^ unreachable pattern

error: unreachable pattern
--> $DIR/consts-opaque.rs:58:9
--> $DIR/consts-opaque.rs:60:9
|
LL | Bar => {}
| --- matches any value
Expand All @@ -52,19 +62,19 @@ LL | _ => {}
| ^ unreachable pattern

error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:63:9
--> $DIR/consts-opaque.rs:65:9
|
LL | BAR => {}
| ^^^

error: unreachable pattern
--> $DIR/consts-opaque.rs:65:9
--> $DIR/consts-opaque.rs:67:9
|
LL | Bar => {} // should not be emitting unreachable warning
| ^^^

error: unreachable pattern
--> $DIR/consts-opaque.rs:67:9
--> $DIR/consts-opaque.rs:69:9
|
LL | Bar => {} // should not be emitting unreachable warning
| --- matches any value
Expand All @@ -73,76 +83,76 @@ LL | _ => {}
| ^ unreachable pattern

error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:72:9
--> $DIR/consts-opaque.rs:74:9
|
LL | BAR => {}
| ^^^

error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:74:9
--> $DIR/consts-opaque.rs:76:9
|
LL | BAR => {} // should not be emitting unreachable warning
| ^^^

error: unreachable pattern
--> $DIR/consts-opaque.rs:74:9
--> $DIR/consts-opaque.rs:76:9
|
LL | BAR => {} // should not be emitting unreachable warning
| ^^^

error: unreachable pattern
--> $DIR/consts-opaque.rs:77:9
--> $DIR/consts-opaque.rs:79:9
|
LL | _ => {} // should not be emitting unreachable warning
| ^

error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:82:9
--> $DIR/consts-opaque.rs:84:9
|
LL | BAZ => {}
| ^^^

error: unreachable pattern
--> $DIR/consts-opaque.rs:84:9
--> $DIR/consts-opaque.rs:86:9
|
LL | Baz::Baz1 => {} // should not be emitting unreachable warning
| ^^^^^^^^^

error: unreachable pattern
--> $DIR/consts-opaque.rs:86:9
--> $DIR/consts-opaque.rs:88:9
|
LL | _ => {}
| ^

error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:92:9
--> $DIR/consts-opaque.rs:94:9
|
LL | BAZ => {}
| ^^^

error: unreachable pattern
--> $DIR/consts-opaque.rs:94:9
--> $DIR/consts-opaque.rs:96:9
|
LL | _ => {}
| ^

error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:99:9
--> $DIR/consts-opaque.rs:101:9
|
LL | BAZ => {}
| ^^^

error: unreachable pattern
--> $DIR/consts-opaque.rs:101:9
--> $DIR/consts-opaque.rs:103:9
|
LL | Baz::Baz2 => {} // should not be emitting unreachable warning
| ^^^^^^^^^

error: unreachable pattern
--> $DIR/consts-opaque.rs:103:9
--> $DIR/consts-opaque.rs:105:9
|
LL | _ => {} // should not be emitting unreachable warning
| ^

error: aborting due to 22 previous errors
error: aborting due to 22 previous errors; 1 warning emitted

0 comments on commit 5bfd3e7

Please sign in to comment.