-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Warn on #![doc(test(...))]
on items other than the crate root and use future incompatible lint
#82708
Conversation
@Manishearth This error should be a warning too. Do you have suggestion for an existing lint I could use here maybe? |
@GuillaumeGomez Yes. I think we should create a combined INVALID_DOC_ATTRIBUTE future incompat lint in #82730 |
Ok, might be worth doing it in this PR directly then. Or do you prefer in another PR? |
r? @Manishearth |
@GuillaumeGomez Fine either way, but please use the future incompat infrastructure (it's a different kind of lint) |
Ok, going to update this PR as soon as possible then! |
Good point. I updated the PR description and I will open another PR which takes the meta item list and run the checks on them. |
#![doc(test(...))]
on items other than the crate root
4c32ac1
to
dbf39f3
Compare
I added the lint with the "future incompatible" as requested. It now warns by default. |
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.
Looks good, cannot be tied to an edition yet. Also I'd like to wait for the regression fix to land so that that can also be migrated to this lint
This comment has been minimized.
This comment has been minimized.
dbf39f3
to
7942bda
Compare
This comment has been minimized.
This comment has been minimized.
7942bda
to
f447cd0
Compare
This comment has been minimized.
This comment has been minimized.
f447cd0
to
4400ec0
Compare
Can we also use this lint for #82702 ? |
@Manishearth Sure, do you want me to add it in this PR as well? |
Yes please! (and update the PR body/title) |
4400ec0
to
55cec90
Compare
#![doc(test(...))]
on items other than the crate root#![doc(test(...))]
on items other than the crate root and use future incompatible lint
I updated the PR, its description and the title. Don't hesitate to tell me if it could be worded better! |
@bors r+ |
📌 Commit 55cec90 has been approved by |
/// Previously, there were very like checks being performed on `#[doc(..)]` | ||
/// unlike the other attributes. It'll now catch all the issues that it | ||
/// silently ignored previously. | ||
pub INVALID_DOC_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.
Lint names should be plural: https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#lints
@bors r- yep, good catch, thanks |
Fixed the lint name! |
@bors r+ |
📌 Commit a11e87e has been approved by |
… r=Manishearth Warn on `#![doc(test(...))]` on items other than the crate root and use future incompatible lint Part of rust-lang#82672. This PR does multiple things: * Create a new `INVALID_DOC_ATTRIBUTE` lint which is also "future incompatible", allowing us to use it as a warning for the moment until it turns (eventually) into a hard error. * Use this link when `#![doc(test(...))]` isn't used at the crate level. * Make rust-lang#82702 use this new lint as well. r? `@jyn514`
…laumeGomez Rollup of 7 pull requests Successful merges: - rust-lang#80845 (Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make transition over hir::ItemKind simpler) - rust-lang#82708 (Warn on `#![doc(test(...))]` on items other than the crate root and use future incompatible lint) - rust-lang#82714 (Detect match arm body without braces) - rust-lang#82736 (Bump optimization from mir_opt_level 2 to 3 and 3 to 4 and make "release" be level 2 by default) - rust-lang#82782 (Make rustc shim's verbose output include crate_name being compiled.) - rust-lang#82797 (Update tests names to start with `issue-`) - rust-lang#82809 (rustdoc: Use substrings instead of split to grab enum variant paths) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Part of #82672.
This PR does multiple things:
INVALID_DOC_ATTRIBUTE
lint which is also "future incompatible", allowing us to use it as a warning for the moment until it turns (eventually) into a hard error.#![doc(test(...))]
isn't used at the crate level.r? @jyn514