Skip to content

doc(cfg(a or b or c) and a) should cut unnecessary conditions #104991

Open
@ventaquil

Description

@ventaquil

I tried this code:

#[doc(
    cfg(
        any(
            feature = "a",
            feature = "b",
            feature = "c",
        )
    )
)]
#[doc(
    cfg(
        feature = "a",
    )
)]
pub fn add(left: usize, right: usize) -> usize {
    left + right
}

I expected to see this happen after creating documentation:

Available on crate feature a only.

Instead, this happened:

Available on (crate features a or b or c) and crate feature a only.

Occured when one module requires any of few features and then submodules requires one of those features - module should list create features a or b or c but submodule should return only create feature a.

Meta

rustc --version --verbose:

rustc 1.67.0-nightly (a00f8ba7f 2022-11-15)
binary: rustc
commit-hash: a00f8ba7fcac1b27341679c51bf5a3271fa82df3
commit-date: 2022-11-15
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4

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