Construct tokens for attrs made by mk_attr_word and other variants#159277
Open
mu001999 wants to merge 1 commit into
Open
Construct tokens for attrs made by mk_attr_word and other variants#159277mu001999 wants to merge 1 commit into
tokens for attrs made by mk_attr_word and other variants#159277mu001999 wants to merge 1 commit into
Conversation
tokens for attrs made by mk_attr_word and other variants
Contributor
|
r? me |
jdonszelmann
approved these changes
Jul 14, 2026
Contributor
There was a problem hiding this comment.
It's a big fix, but I think it actually addresses multiple longstanding issues. EIIs do the same, where they generate attributes, and I'm sure it was secretly vulnerable to the same ICE. Same for bench and global_allocator prolly too. I guess it's maybe even for the better we found out about this hehe, even though I guess I'm to blame for causing the regression.
Thanks @mu001999 !
r=me if you're ready @mu001999 , maybe undraft it, but I think this is a fine solution :3
| #[test_macros::identity_attr] | ||
| fn test() {} | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
I love that you test it with macro_attr, it's a much more concise test like this
Contributor
|
📋 Only open, non-draft PRs can be approved. |
Member
Author
|
@bors r=jdonszelmann rollup |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jul 14, 2026
…nszelmann Construct `tokens` for attrs made by `mk_attr_word` and other variants Fixes rust-lang#159261 `tokens` won't be constructed for generated built-in attrs before, so that after rust-lang#158854, `#[rustc_test_entrypoint_marker]` without `tokens` would be added when expanding `#[test]`. Then later expansions would cause the ICE when they wanna get the attr's `tokens`. This PR makes `tokens` constructed for such attrs, although this specific ICE only need editing `mk_attr_word`, but I think it would be good to also edit `mk_attr_nested_word` and `mk_attr_name_value_str`.
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jul 14, 2026
…nszelmann Construct `tokens` for attrs made by `mk_attr_word` and other variants Fixes rust-lang#159261 `tokens` won't be constructed for generated built-in attrs before, so that after rust-lang#158854, `#[rustc_test_entrypoint_marker]` without `tokens` would be added when expanding `#[test]`. Then later expansions would cause the ICE when they wanna get the attr's `tokens`. This PR makes `tokens` constructed for such attrs, although this specific ICE only need editing `mk_attr_word`, but I think it would be good to also edit `mk_attr_nested_word` and `mk_attr_name_value_str`.
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jul 14, 2026
…nszelmann Construct `tokens` for attrs made by `mk_attr_word` and other variants Fixes rust-lang#159261 `tokens` won't be constructed for generated built-in attrs before, so that after rust-lang#158854, `#[rustc_test_entrypoint_marker]` without `tokens` would be added when expanding `#[test]`. Then later expansions would cause the ICE when they wanna get the attr's `tokens`. This PR makes `tokens` constructed for such attrs, although this specific ICE only need editing `mk_attr_word`, but I think it would be good to also edit `mk_attr_nested_word` and `mk_attr_name_value_str`.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #159261
tokenswon't be constructed for generated built-in attrs before, so that after #158854,#[rustc_test_entrypoint_marker]withouttokenswould be added when expanding#[test]. Then later expansions would cause the ICE when they wanna get the attr'stokens.This PR makes
tokensconstructed for such attrs, although this specific ICE only need editingmk_attr_word, but I think it would be good to also editmk_attr_nested_wordandmk_attr_name_value_str.