Skip to content
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

rustdoc::all triggers unknown_lints #106289

Closed
daxpedda opened this issue Dec 30, 2022 · 1 comment · Fixed by #106316
Closed

rustdoc::all triggers unknown_lints #106289

daxpedda opened this issue Dec 30, 2022 · 1 comment · Fixed by #106316
Assignees
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@daxpedda
Copy link
Contributor

daxpedda commented Dec 30, 2022

Current behavior

Currently, in both stable (1.66.0) and nightly (2381cbdb4 2022-12-23), using rustdoc::all will trigger unknown_lints:

warning: unknown lint: `rustdoc::missing_doc_code_examples`
 --> src/lib.rs:5:18
  |
5 | #![cfg_attr(doc, warn(rustdoc::all))]
  |                  ^^^^^^^^^^^^^^^^^^
  |
  = note: the `rustdoc::missing_doc_code_examples` lint is unstable
  = note: see issue #101730 <https://github.com/rust-lang/rust/issues/101730> for more information
  = note: `#[warn(unknown_lints)]` on by default

Expected behavior

The expected behavior would be that a stable lint group shouldn't use unstable lints unless the unstable feature is active.

Problem

The current behavior is weird because you can't make the warning go away without using allow(unknown_lints) or enabling the unstable feature and using allow(rustdoc::missing_doc_code_examples).

This broke CIs on multiple occasions that have simply been using RUSTDOCFLAGS=-Dwarnings cargo doc.

Current Workaround

Currently the workaround fix is: #![cfg_attr(doc, allow(unknown_lints), warn(rustdoc::all))].

Tested Versions

Stable:

cargo 1.66.0 (d65d197ad 2022-11-15)
release: 1.66.0
commit-hash: d65d197ad5c6c09234369f219f943e291d4f04b9
commit-date: 2022-11-15
host: x86_64-unknown-linux-gnu

Nightly:

cargo 1.68.0-nightly (2381cbdb4 2022-12-23)
release: 1.68.0-nightly
commit-hash: 2381cbdb4e9b07090f552d34a44a529b6e620e44
commit-date: 2022-12-23
host: x86_64-unknown-linux-gnu
@daxpedda daxpedda changed the title rustdoc::all triggers unknown_lints lint rustdoc::all triggers unknown_lints Dec 30, 2022
@Noratrieb Noratrieb added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Dec 30, 2022
@camelid camelid added the C-bug Category: This is a bug. label Dec 31, 2022
@camelid camelid self-assigned this Dec 31, 2022
@TheNewJavaman
Copy link

This is why I love the Rust community -- I just had this issue and saw that your fix was committed 23 minutes ago. Kudos 🙂

camelid added a commit to camelid/rust that referenced this issue Feb 20, 2023
Including unstable lints in the lint group produces unintuitive behavior
on stable (see rust-lang#106289). Meanwhile, if we only included unstable lints
on nightly and not on stable, we could end up with confusing bugs that
were hard to compare across versions of Rust that lacked code changes.

I think that only including stable lints in `rustdoc::all`, no matter
the release channel, is the most intuitive option. Users can then
control unstable lints individually, which is reasonable since they have
to enable the feature gates individually anyway.
@bors bors closed this as completed in 7e253a7 Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants