Add test for #80607 with undesired output

This commit is contained in:
Dániel Buga 2021-01-02 10:58:50 +01:00
parent f6b6d5cf64
commit eb0d5be441
2 changed files with 24 additions and 0 deletions

View File

@ -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() {}

View File

@ -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`.