-
Notifications
You must be signed in to change notification settings - Fork 13.5k
rustdoc: skip // some variants omitted
if enum is #[non_exhaustive]
#109007
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @jsha (rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred in src/librustdoc/clean/types.rs cc @camelid |
8b118d3
to
db038b2
Compare
db038b2
to
496e77e
Compare
496e77e
to
ea89853
Compare
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 think this lint may need a crater run to make sure the warning doesn't cause too much breakage. I'm also not familiar with the motivation for this change, but in some ways, I think the lint may be a better fit for clippy. The reason is I'm a bit concerned it could be triggered by valid code.
@camelid I'm not convinced by this change now, it breaks /// The styles of printing that we can print
#[derive(Copy, Clone, Eq, PartialEq)]
pub enum PrintFmt {
/// Prints a terser backtrace which ideally only contains relevant information
Short,
/// Prints a backtrace that contains all possible information
Full,
#[doc(hidden)]
__Nonexhaustive,
} It's just wrong and the exact thing this lint is for. Not sure where you want to go from here. |
I have to admit I don't know the factors that would favor a rustdoc lint or a clippy lint. Above you mention that it could be triggered by valid code. Are rustdoc lints only for input that is definitely invalid? |
@jsha Not sure if someone else was going to answer this; nobody else has so here goes: I think that possibly valid code should never be triggered by (warn-by-default) rustdoc lints, period. I think that the question here is really: is code valid if it contains The bottom line is: there is nothing we can feasibly do while this lint exists to get it to pass CI. I'll remove the lint and maybe we can land the one-line change which is the other part of this PR.. |
ea89853
to
cdc9cc0
Compare
I think this lint makes more sense in Clippy than in Rustdoc. |
@notriddle Agreed, I've removed that part of the PR, now there is just the one liner fix which the linked issue was primarily concerned with. |
@jsha Can we land this now? |
// some variants omitted
with #[non_exhaustive]
// some variants omitted
if enum is #[non_exhaustive]
I updated the title since I believe the content of this PR has changed. |
Please add a test for it and then I'll approve it. Also, if not done already, I think adding this as a clippy lint would be nice. Please at least open an issue there so it's not forgotten. |
Don't display `// some variants omitted` if enum is marked `#[non_exhaustive]`
cdc9cc0
to
e0ec9c0
Compare
@bors r=notriddle,GuillaumeGomez rollup |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#109007 (rustdoc: skip `// some variants omitted` if enum is `#[non_exhaustive]`) - rust-lang#109593 (Rustdoc Book refer to rustdoc::missing_doc_code_examples. Fixes rust-lang#109592.) - rust-lang#109595 (Improve "Auto-hide trait implementation documentation" GUI test) - rust-lang#109619 (Still-further-specializable projections are ambiguous in new solver) - rust-lang#109620 (Correct typo (`back_box` -> `black_box`)) - rust-lang#109621 (Refactor: `VariantIdx::from_u32(0)` -> `FIRST_VARIANT`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #108925
Never touched rustdoc before so probably not the best code.
cc @dtolnay