-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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 #114704 - bvanjoi:fix-114636, r=compiler-errors
parser: not insert dummy field in struct Fixes #114636 This PR eliminates the dummy field, initially introduced in #113999, thereby enabling unrestricted use of `ident.unwrap()`. A side effect of this action is that we can only report the error of the first macro invocation field within the struct node. An alternative solution might be giving a virtual name to the macro, but it appears more complex.(#114636 (comment)). Furthermore, if you think #114636 (comment) is a better solution, feel free to close this PR.
- Loading branch information
Showing
3 changed files
with
47 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,71 @@ | ||
error: unexpected token: `!` | ||
--> $DIR/macro-expand-to-field.rs:16:10 | ||
--> $DIR/macro-expand-to-field.rs:19:10 | ||
| | ||
LL | struct Struct { | ||
| ------ while parsing this struct | ||
LL | | ||
LL | field!(bar:u128), | ||
| ^ unexpected token after this | ||
| | ||
= note: macros cannot expand to struct fields | ||
|
||
error: unexpected token: `!` | ||
--> $DIR/macro-expand-to-field.rs:22:10 | ||
| | ||
LL | field!(recovers:()), | ||
| ^ unexpected token after this | ||
| | ||
= note: macros cannot expand to struct fields | ||
|
||
error: unexpected token: `!` | ||
--> $DIR/macro-expand-to-field.rs:28:12 | ||
--> $DIR/macro-expand-to-field.rs:29:12 | ||
| | ||
LL | variant!(whoops), | ||
| ^ unexpected token after this | ||
| | ||
= note: macros cannot expand to enum variants | ||
|
||
error: unexpected token: `!` | ||
--> $DIR/macro-expand-to-field.rs:34:12 | ||
--> $DIR/macro-expand-to-field.rs:35:12 | ||
| | ||
LL | variant!(recovers), | ||
| ^ unexpected token after this | ||
| | ||
= note: macros cannot expand to enum variants | ||
|
||
error: unexpected token: `!` | ||
--> $DIR/macro-expand-to-field.rs:39:14 | ||
--> $DIR/macro-expand-to-field.rs:40:14 | ||
| | ||
LL | Data { | ||
| ---- while parsing this struct | ||
LL | field!(x:u32), | ||
| ^ unexpected token after this | ||
| | ||
= note: macros cannot expand to struct fields | ||
|
||
error: unexpected token: `!` | ||
--> $DIR/macro-expand-to-field.rs:48:14 | ||
--> $DIR/macro-expand-to-field.rs:49:14 | ||
| | ||
LL | Named { | ||
| ----- while parsing this struct | ||
LL | field!(oopsies:()), | ||
| ^ unexpected token after this | ||
| | ||
= note: macros cannot expand to struct fields | ||
|
||
error: unexpected token: `!` | ||
--> $DIR/macro-expand-to-field.rs:52:14 | ||
| | ||
LL | field!(oopsies2:()), | ||
| ^ unexpected token after this | ||
| | ||
= note: macros cannot expand to struct fields | ||
|
||
error: unexpected token: `!` | ||
--> $DIR/macro-expand-to-field.rs:61:10 | ||
--> $DIR/macro-expand-to-field.rs:60:10 | ||
| | ||
LL | union Union { | ||
| ----- while parsing this union | ||
... | ||
LL | field!(oopsies:()), | ||
| ^ unexpected token after this | ||
| | ||
= note: macros cannot expand to union fields | ||
|
||
error: unexpected token: `!` | ||
--> $DIR/macro-expand-to-field.rs:66:10 | ||
--> $DIR/macro-expand-to-field.rs:73:16 | ||
| | ||
LL | field!(recovers:()), | ||
| ^ unexpected token after this | ||
LL | pub struct Lazy { | ||
| ---- while parsing this struct | ||
LL | | ||
LL | unreachable!() | ||
| ^ unexpected token after this | ||
| | ||
= note: macros cannot expand to union fields | ||
= note: macros cannot expand to struct fields | ||
|
||
error: aborting due to 9 previous errors | ||
error: aborting due to 7 previous errors | ||
|