Skip to content

rustdoc::all triggers unknown_lints #106289

Closed
@daxpedda

Description

@daxpedda

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

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions