-
Notifications
You must be signed in to change notification settings - Fork 13.8k
improve diagnostics for empty attributes #146653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
r? compiler |
☔ The latest upstream changes (presumably #146862) made this pull request unmergeable. Please resolve the merge conflicts. |
r? nnethercote |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I don't think this is an improvement. As explained below, in every case the note feels not quite right. The motivation was to restore the old behaviour for feature
but I don't think it is necessary.
LL | #[macro_use()] | ||
| ^^ help: remove this attribute | ||
| | ||
= note: attribute `macro_use` with an empty list has no effect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit surprised this is only a warning. But also, the note feels misleading: I assume macro_use()
with an empty list does have an effect, i.e. the same effect as just macro_use
.
A better improvement for this error message would be to say "remove these parentheses" instead of "remove this attribute".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a fix that makes this error better specifically when the no-argument version is available and so valid
91bc78a
to
b3631e1
Compare
This PR was rebased onto a different master 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github is borken (this comment was made as a dummy to get around a UI bug)
@rustbot review |
@bors r+ rollup |
Rollup of 5 pull requests Successful merges: - #146653 (improve diagnostics for empty attributes) - #146987 (impl Ord for params and use unstable sort) - #147101 (Use `Iterator::eq` and (dogfood) `eq_by` in compiler and library ) - #147123 (Fix removed version numbers of `doc_auto_cfg` and `doc_cfg_hide`) - #147149 (add joboet to library review rotation) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #146653 - jdonszelmann:empty-attr-diags, r=nnethercote improve diagnostics for empty attributes Adds a note about them not having any effect. This was previously done for `feature` attributes but no other attributes. In [converting the `feature` parser](#146652) I removed that note. This PR adds it back in and makes it so all attributes benefit from it. Not blocked on #146652, either can merge first
Rollup of 5 pull requests Successful merges: - rust-lang/rust#146653 (improve diagnostics for empty attributes) - rust-lang/rust#146987 (impl Ord for params and use unstable sort) - rust-lang/rust#147101 (Use `Iterator::eq` and (dogfood) `eq_by` in compiler and library ) - rust-lang/rust#147123 (Fix removed version numbers of `doc_auto_cfg` and `doc_cfg_hide`) - rust-lang/rust#147149 (add joboet to library review rotation) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 5 pull requests Successful merges: - rust-lang/rust#146653 (improve diagnostics for empty attributes) - rust-lang/rust#146987 (impl Ord for params and use unstable sort) - rust-lang/rust#147101 (Use `Iterator::eq` and (dogfood) `eq_by` in compiler and library ) - rust-lang/rust#147123 (Fix removed version numbers of `doc_auto_cfg` and `doc_cfg_hide`) - rust-lang/rust#147149 (add joboet to library review rotation) r? `@ghost` `@rustbot` modify labels: rollup
Adds a note about them not having any effect. This was previously done for
feature
attributes but no other attributes. In converting thefeature
parser I removed that note. This PR adds it back in and makes it so all attributes benefit from it.Not blocked on #146652, either can merge first