-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #80563 - petrochenkov:expattronmac, r=Aaron1011
resolve/expand: Improve attribute expansion on macro definitions and calls - Do not forget to visit attributes on macro definitions and calls in couple of places. - Remove some weird special treatment of macro definition items, which is probably left from old times when macro definitions were treated more like macro calls. Fixes #80540
- Loading branch information
Showing
8 changed files
with
63 additions
and
40 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
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 @@ | ||
#![feature(extended_key_value_attributes)] | ||
#![feature(rustc_attrs)] | ||
|
||
#[rustc_dummy = stringify!(a)] // OK | ||
macro_rules! bar { | ||
() => {}; | ||
} | ||
|
||
// FIXME?: `bar` here expands before `stringify` has a chance to expand. | ||
// `#[rustc_dummy = ...]` is validated and dropped during expansion of `bar`, | ||
// the "unexpected token" errors comes from the validation. | ||
#[rustc_dummy = stringify!(b)] //~ ERROR unexpected token: `stringify!(b)` | ||
bar!(); | ||
|
||
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,8 @@ | ||
error: unexpected token: `stringify!(b)` | ||
--> $DIR/key-value-expansion-on-mac.rs:12:17 | ||
| | ||
LL | #[rustc_dummy = stringify!(b)] | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
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