Skip to content

Also warn if an invalid doc attribute is used on a macro invocation - #161003

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
GuillaumeGomez:doc-attr-macro-invoc
Aug 13, 2026
Merged

Also warn if an invalid doc attribute is used on a macro invocation#161003
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
GuillaumeGomez:doc-attr-macro-invoc

Conversation

@GuillaumeGomez

@GuillaumeGomez GuillaumeGomez commented Aug 12, 2026

Copy link
Copy Markdown
Member

Part of #160880.

So about this: I think the error message is good enough, but I can specialize it in case it's not a doc comment but a doc attribute.

Also: currently the ignored attributes are not kept in the AST, so when we reach rustc_attr_parsing, the attribute is not present and there won't trigger an error. I don't think it's worth changing this logic but in case someone thinks otherwise, it's mentioned. :)

r? @JonathanBrouwer

@rustbot rustbot added 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. labels Aug 12, 2026

@mejrs mejrs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r? me

so when we reach rustc_attr_parsing, the attribute is not present and there won't trigger an error. I don't think it's worth changing this logic but in case someone things otherwise, it's mentioned. :)

that's implemented in #160904, which does this (sort of) and also like three other things 🙈

I think this is a good step to merge first, makes ^ a bit simpler.

@bors r+ rollup

View changes since this review

@rust-bors

rust-bors Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a09d72a has been approved by mejrs

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 12, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

@mejrs Nicely done!

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 12, 2026
…c, r=mejrs

Also warn if an invalid `doc` attribute is used on a macro invocation

Fixes rust-lang#160880.

So about this: I think the error message is good enough, but I can specialize it in case it's not a doc comment but a doc attribute.

Also: currently the ignored attributes are not kept in the AST, so when we reach `rustc_attr_parsing`, the attribute is not present and there won't trigger an error. I don't think it's worth changing this logic but in case someone thinks otherwise, it's mentioned. :)

r? @JonathanBrouwer
@mejrs

mejrs commented Aug 12, 2026

Copy link
Copy Markdown
Member

Also just a note - I don't think this fixes #160880. I think we should FCW on that and later try a crater run and see if we can get away with erroring on it again.

rust-bors Bot pushed a commit that referenced this pull request Aug 13, 2026
Rollup of 13 pull requests

Successful merges:

 - #160976 (Ensure TLS accesses don't call the global allocator through panic (part 2))
 - #160438 ([rustdoc] Change table odd table rows background color to not make it the same as inline code)
 - #160985 (self-profile more of borrowck)
 - #137858 (Add new `unused_footnote_definition` rustdoc lint)
 - #159566 (Add support for generics in `offload`and remove `no_mangle` attribute)
 - #160676 (rustc_public: split `def`s out of `ty`)
 - #160861 (rustc_parse: suggest removing semicolon before `if` block)
 - #160958 (Remove unused `#[non_exhaustive]` in library)
 - #160978 (move resolve_path to Session inherent method)
 - #160990 (Remove old cfg parser which is now dead code)
 - #160991 (Add offload component on nightly)
 - #160999 (doc changes to expect messages in process.rs)
 - #161003 (Also warn if an invalid `doc` attribute is used on a macro invocation)
rust-bors Bot pushed a commit that referenced this pull request Aug 13, 2026
Rollup of 13 pull requests

Successful merges:

 - #160976 (Ensure TLS accesses don't call the global allocator through panic (part 2))
 - #160438 ([rustdoc] Change table odd table rows background color to not make it the same as inline code)
 - #160985 (self-profile more of borrowck)
 - #137858 (Add new `unused_footnote_definition` rustdoc lint)
 - #159566 (Add support for generics in `offload`and remove `no_mangle` attribute)
 - #160676 (rustc_public: split `def`s out of `ty`)
 - #160861 (rustc_parse: suggest removing semicolon before `if` block)
 - #160958 (Remove unused `#[non_exhaustive]` in library)
 - #160978 (move resolve_path to Session inherent method)
 - #160990 (Remove old cfg parser which is now dead code)
 - #160991 (Add offload component on nightly)
 - #160999 (doc changes to expect messages in process.rs)
 - #161003 (Also warn if an invalid `doc` attribute is used on a macro invocation)
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Replaced it with "part of" then.

@rust-bors
rust-bors Bot merged commit f5196ef into rust-lang:main Aug 13, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Aug 13, 2026
@GuillaumeGomez
GuillaumeGomez deleted the doc-attr-macro-invoc branch August 13, 2026 10:26
rust-timer added a commit that referenced this pull request Aug 13, 2026
Rollup merge of #161003 - GuillaumeGomez:doc-attr-macro-invoc, r=mejrs

Also warn if an invalid `doc` attribute is used on a macro invocation

Fixes #160880.

So about this: I think the error message is good enough, but I can specialize it in case it's not a doc comment but a doc attribute.

Also: currently the ignored attributes are not kept in the AST, so when we reach `rustc_attr_parsing`, the attribute is not present and there won't trigger an error. I don't think it's worth changing this logic but in case someone thinks otherwise, it's mentioned. :)

r? @JonathanBrouwer
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (d80b7f1): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

Results (primary -1.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.5% [-1.5%, -1.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.5% [-1.5%, -1.5%] 1

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 455.642s -> 454.976s (-0.15%)
Artifact size: 396.40 MiB -> 396.36 MiB (-0.01%)

@BoxyUwU BoxyUwU added the relnotes Marks issues that should be documented in the release notes of the next release. label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

6 participants