Update to new API, allowing to remove check_doc_cfg.rs file from librustdoc

This commit is contained in:
Guillaume Gomez 2025-12-09 22:27:28 +01:00
parent 40907f522d
commit 64aaeacd71
13 changed files with 59 additions and 135 deletions

View file

@ -12,5 +12,7 @@
// Shouldn't lint
#[doc(auto_cfg(hide(windows)))]
#[doc(auto_cfg(hide(feature = "windows")))]
//~^ WARN unexpected `cfg` condition name: `feature`
#[doc(auto_cfg(hide(foo)))]
//~^ WARN unexpected `cfg` condition name: `foo`
pub fn foo() {}

View file

@ -56,5 +56,23 @@ error: expected boolean for `#[doc(auto_cfg = ...)]`
LL | #[doc(auto_cfg = "a")]
| ^^^
error: aborting due to 6 previous errors; 2 warnings emitted
warning: unexpected `cfg` condition name: `feature`
--> $DIR/doc-cfg-2.rs:14:21
|
LL | #[doc(auto_cfg(hide(feature = "windows")))]
| ^^^^^^^^^^^^^^^^^^^
|
= help: to expect this configuration use `--check-cfg=cfg(feature, values("windows"))`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `foo`
--> $DIR/doc-cfg-2.rs:16:21
|
LL | #[doc(auto_cfg(hide(foo)))]
| ^^^
|
= help: to expect this configuration use `--check-cfg=cfg(foo)`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
error: aborting due to 6 previous errors; 4 warnings emitted

View file

@ -1,8 +1,8 @@
warning: unexpected `cfg` condition name: `foo`
--> $DIR/doc-cfg-check-cfg.rs:12:12
--> $DIR/doc-cfg-check-cfg.rs:15:11
|
LL | #![doc(cfg(foo))]
| ^^^
LL | #[doc(cfg(foo))]
| ^^^
|
= help: to expect this configuration use `--check-cfg=cfg(foo)`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
@ -18,10 +18,10 @@ LL | #[doc(cfg(foo))]
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `foo`
--> $DIR/doc-cfg-check-cfg.rs:15:11
--> $DIR/doc-cfg-check-cfg.rs:12:12
|
LL | #[doc(cfg(foo))]
| ^^^
LL | #![doc(cfg(foo))]
| ^^^
|
= help: to expect this configuration use `--check-cfg=cfg(foo)`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration

View file

@ -1,5 +1,4 @@
Available passes for running rustdoc:
check-doc-cfg - checks `#[doc(cfg(...))]` for stability feature and unexpected cfgs
check_doc_test_visibility - run various visibility-related lints on doctests
propagate-doc-cfg - propagates `#[doc(cfg(...))]` to child items
strip-aliased-non-local - strips all non-local private aliased items from the output
@ -15,7 +14,6 @@ calculate-doc-coverage - counts the number of items with and without documentati
Default passes for rustdoc:
collect-trait-impls
check_doc_test_visibility
check-doc-cfg
strip-aliased-non-local
propagate-doc-cfg
strip-hidden (when not --document-hidden-items)