FCW on expressions in doc attributes on macro calls - #160904
Open
mejrs wants to merge 1 commit into
Open
Conversation
mejrs
force-pushed
the
doc_feature_gating
branch
from
August 11, 2026 12:07
63a2f0f to
f705d49
Compare
This comment has been minimized.
This comment has been minimized.
mejrs
force-pushed
the
doc_feature_gating
branch
from
August 12, 2026 09:40
f705d49 to
11ac310
Compare
This comment has been minimized.
This comment has been minimized.
mejrs
force-pushed
the
doc_feature_gating
branch
from
August 13, 2026 11:11
11ac310 to
478a22c
Compare
This comment has been minimized.
This comment has been minimized.
mejrs
force-pushed
the
doc_feature_gating
branch
from
August 13, 2026 12:12
478a22c to
65407a3
Compare
This comment has been minimized.
This comment has been minimized.
mejrs
force-pushed
the
doc_feature_gating
branch
from
August 14, 2026 21:21
65407a3 to
9b15145
Compare
This comment has been minimized.
This comment has been minimized.
mejrs
force-pushed
the
doc_feature_gating
branch
from
August 15, 2026 17:07
9b15145 to
dd5debd
Compare
This comment has been minimized.
This comment has been minimized.
mejrs
force-pushed
the
doc_feature_gating
branch
from
August 16, 2026 14:37
dd5debd to
1953f77
Compare
This comment has been minimized.
This comment has been minimized.
mejrs
force-pushed
the
doc_feature_gating
branch
from
August 16, 2026 15:34
1953f77 to
3888e00
Compare
mejrs
marked this pull request as ready for review
August 16, 2026 15:42
Collaborator
|
Some changes occurred in compiler/rustc_attr_parsing cc @jdonszelmann, @JonathanBrouwer These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
mejrs
force-pushed
the
doc_feature_gating
branch
from
August 19, 2026 22:26
3888e00 to
8c0900d
Compare
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
mejrs
force-pushed
the
doc_feature_gating
branch
from
August 19, 2026 23:11
8c0900d to
9fdd707
Compare
Member
Author
|
@JonathanBrouwer this is ready for review now |
This comment has been minimized.
This comment has been minimized.
mejrs
force-pushed
the
doc_feature_gating
branch
from
August 20, 2026 00:01
9fdd707 to
254ea39
Compare
This comment has been minimized.
This comment has been minimized.
mejrs
force-pushed
the
doc_feature_gating
branch
from
August 20, 2026 11:58
254ea39 to
623360c
Compare
Contributor
|
☔ The latest upstream changes (presumably #161043) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
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.
Recently I discovered that, since Rust 1.94, doc attributes on macro invocations can have arbitrary expressions in them:
As part of the attribute parsing rework this was accidentally allowed. Note that doc attributes (or any doc comment) on macro invocations do nothing, because documentation for macro invocations is not rendered - this emits a lint saying macros must produce doc comments as part of their expansion.
With this PR, it now emits a FCW, like #57571. As this is so niche it's probable this could go straight to an error but there's quite a crater queue so I'd rather do this now and try turning it into an error later.
Note that
#[doc = mac!()]is included in this. While this is allowed everywhere else as normally attribute parsing only sees it after its expansion, it is not expanded here, but we do need to check attributes here since we can't check them later as they're lost by then.I don't think it is worth trying to make particular case work - this would involve checking that the expression would expand to a string literal:
This change would also make it consistent with all other key-value attributes. For an example, the following are allowed
but this is not:
This PR implements some non-visible changes as well
r? @JonathanBrouwer