Skip to content

rework handling of doc attributes on macro calls - #160904

Open
mejrs wants to merge 1 commit into
rust-lang:mainfrom
mejrs:doc_feature_gating
Open

rework handling of doc attributes on macro calls#160904
mejrs wants to merge 1 commit into
rust-lang:mainfrom
mejrs:doc_feature_gating

Conversation

@mejrs

@mejrs mejrs commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

This PR implements the following

  • move feature gating of doc attributes to attribute parsing
  • remove OmitDoc (only used for doc expressions on macro calls..?)
  • the following lint is now emitted:
// accidentally stabilized in 1.94
#[doc = {
    let a = 1;
    let b = 1;
    let sum = a + b;
    assert_eq!(sum, 2);
}]
foo!();
warning: arbitrary expressions in doc attributes were previously accepted by the compiler
but are being phased out; it will become a hard error in a future release!
   |
LL |       #[doc = {
   |  _____________^
LL | |         let a = 1;
LL | |         let b = 1;
LL | |         let sum = a + b;
LL | |         assert_eq!(sum, 2);
LL | |     }]
   | |_____^

I'd like to try to error on that; I'll do a crater run at some point in the future.

r? @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 11, 2026
@mejrs
mejrs force-pushed the doc_feature_gating branch from 63a2f0f to f705d49 Compare August 11, 2026 12:07
@rust-log-analyzer

This comment has been minimized.

@mejrs
mejrs force-pushed the doc_feature_gating branch from f705d49 to 11ac310 Compare August 12, 2026 09:40
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@mejrs
mejrs force-pushed the doc_feature_gating branch from 478a22c to 65407a3 Compare August 13, 2026 12:12
@rust-log-analyzer

This comment has been minimized.

@mejrs
mejrs force-pushed the doc_feature_gating branch from 65407a3 to 9b15145 Compare August 14, 2026 21:21
@rust-log-analyzer

This comment has been minimized.

@mejrs
mejrs force-pushed the doc_feature_gating branch from 9b15145 to dd5debd Compare August 15, 2026 17:07
@rust-log-analyzer

This comment has been minimized.

@mejrs
mejrs force-pushed the doc_feature_gating branch from dd5debd to 1953f77 Compare August 16, 2026 14:37
@rust-log-analyzer

This comment has been minimized.

@mejrs
mejrs force-pushed the doc_feature_gating branch from 1953f77 to 3888e00 Compare August 16, 2026 15:34
@mejrs
mejrs marked this pull request as ready for review August 16, 2026 15:42
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 16, 2026
@rustbot

rustbot commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants