rustdoc doesn't gate cfg(true/false)
within doc(cfg(..))
· Issue #138113 · rust-lang/rust (original) (raw)
I tried this code:
// #![feature(cfg_boolean_literals)] should be required #![feature(doc_cfg)]
#[doc(cfg(false))] pub fn foo() {}
#[doc(cfg(true))] pub fn bar() {}
I expected to see this happen: An error requiring #![feature(cfg_boolean_literals)]
, as is the case currently when done #[cfg(true)]
.
Instead, this happened: The documenation is generated and no extra feature gate is required.
Meta
rustdoc --version --verbose
:
rustdoc 1.87.0-nightly (e16a049ad 2025-03-03)
binary: rustdoc
commit-hash: e16a049adbf94d610787430b6efdf31d896dc5b6
commit-date: 2025-03-03
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0