Skip to content

doc(auto_cfg) and doc(cfg) don't add cfgs to re-exported type aliases #154921

@clarfonthey

Description

@clarfonthey

Code

This will include the cfgs in the docs:

#![feature(doc_cfg)]
#![doc(auto_cfg)]

#[cfg(target_os = "linux")]
pub type One = u32;

#[doc(cfg(target_os = "linux"))]
pub type Two = u32;

But this will not:

#![feature(doc_cfg)]
#![doc(auto_cfg)]

mod inner {
    #[cfg(target_os = "linux")]
    pub type One = u32;

    #[doc(cfg(target_os = "linux"))]
    pub type Two = u32;
}

pub use self::inner::{One, Two};

Both

Version

rustdoc 1.96.0-nightly (55e86c996 2026-04-02)

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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions