forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unify errors for tuple/struct variants
fix rust-lang#63983
- Loading branch information
Guanqun Lu
committed
Sep 21, 2019
1 parent
9ad1e7c
commit e001c5f
Showing
5 changed files
with
43 additions
and
5 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
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
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
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,15 @@ | ||
enum MyEnum { | ||
Tuple(i32), | ||
Struct{ s: i32 }, | ||
} | ||
|
||
fn foo(en: MyEnum) { | ||
match en { | ||
MyEnum::Tuple => "", | ||
//~^ ERROR expected unit struct/variant or constant, found tuple variant `MyEnum::Tuple` | ||
MyEnum::Struct => "", | ||
//~^ ERROR expected unit struct/variant or constant, found struct variant `MyEnum::Struct` | ||
}; | ||
} | ||
|
||
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,15 @@ | ||
error[E0532]: expected unit struct/variant or constant, found tuple variant `MyEnum::Tuple` | ||
--> $DIR/issue-63983.rs:8:9 | ||
| | ||
LL | MyEnum::Tuple => "", | ||
| ^^^^^^^^^^^^^ did you mean `MyEnum::Tuple ( /* fields */ )`? | ||
|
||
error[E0532]: expected unit struct/variant or constant, found struct variant `MyEnum::Struct` | ||
--> $DIR/issue-63983.rs:10:9 | ||
| | ||
LL | MyEnum::Struct => "", | ||
| ^^^^^^^^^^^^^^ did you mean `MyEnum::Struct { /* fields */ }`? | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0532`. |