Skip to content

rustdoc doesn't gate cfg(true/false) within doc(cfg(..)) #138113

Closed
@Urgau

Description

@Urgau

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-doc_cfg`#![feature(doc_cfg)]`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