forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for rust-lang#80607 with undesired output
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |