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.
Rollup merge of rust-lang#66641 - VirrageS:master, r=Centril
parser: recover on nested ADTs as enum variants Closes: rust-lang#66127
- Loading branch information
Showing
3 changed files
with
69 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
enum Foo { | ||
enum Bar { Baz }, //~ ERROR `enum` definition cannot be nested inside `enum` | ||
struct Quux { field: u8 }, //~ ERROR `struct` definition cannot be nested inside `enum` | ||
union Wibble { field: u8 }, //~ ERROR `union` definition cannot be nested inside `enum` | ||
Bat, | ||
} | ||
|
||
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,26 @@ | ||
error: `enum` definition cannot be nested inside `enum` | ||
--> $DIR/nested-enum.rs:2:5 | ||
| | ||
LL | enum Bar { Baz }, | ||
| ^^^^------------ | ||
| | | ||
| help: consider creating a new `enum` definition instead of nesting | ||
|
||
error: `struct` definition cannot be nested inside `enum` | ||
--> $DIR/nested-enum.rs:3:5 | ||
| | ||
LL | struct Quux { field: u8 }, | ||
| ^^^^^^------------------- | ||
| | | ||
| help: consider creating a new `struct` definition instead of nesting | ||
|
||
error: `union` definition cannot be nested inside `enum` | ||
--> $DIR/nested-enum.rs:4:5 | ||
| | ||
LL | union Wibble { field: u8 }, | ||
| ^^^^^--------------------- | ||
| | | ||
| help: consider creating a new `union` definition instead of nesting | ||
|
||
error: aborting due to 3 previous errors | ||
|