Skip to content

Commit eb0d5be

Browse files
committed
Add test for #80607 with undesired output
1 parent f6b6d5c commit eb0d5be

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/test/ui/issues/issue-80607.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This tests makes sure the diagnostics print the offending enum variant, not just the type.
2+
pub enum Enum {
3+
V1(i32),
4+
}
5+
6+
pub fn foo(x: i32) -> Enum {
7+
Enum::V1 { x } //~ ERROR field does not exist
8+
}
9+
10+
fn main() {}

src/test/ui/issues/issue-80607.stderr

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0559]: variant `Enum::V1` has no field named `x`
2+
--> $DIR/issue-80607.rs:7:16
3+
|
4+
LL | V1(i32),
5+
| -- `Enum` defined here
6+
...
7+
LL | Enum::V1 { x }
8+
| -------- ^ field does not exist
9+
| |
10+
| `Enum` is a tuple variant, use the appropriate syntax: `Enum(/* fields */)`
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0559`.

0 commit comments

Comments
 (0)