Skip to content

Commit

Permalink
Add test for rust-lang#80607 with undesired output
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Jan 2, 2021
1 parent f6b6d5c commit eb0d5be
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/test/ui/issues/issue-80607.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This tests makes sure the diagnostics print the offending enum variant, not just the type.
pub enum Enum {
V1(i32),
}

pub fn foo(x: i32) -> Enum {
Enum::V1 { x } //~ ERROR field does not exist
}

fn main() {}
14 changes: 14 additions & 0 deletions src/test/ui/issues/issue-80607.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error[E0559]: variant `Enum::V1` has no field named `x`
--> $DIR/issue-80607.rs:7:16
|
LL | V1(i32),
| -- `Enum` defined here
...
LL | Enum::V1 { x }
| -------- ^ field does not exist
| |
| `Enum` is a tuple variant, use the appropriate syntax: `Enum(/* fields */)`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0559`.

0 comments on commit eb0d5be

Please sign in to comment.