Skip to content

doc(cfg) doesn't work on glob reexports #96166

Closed

Description

@CAD97

I tried this code:

#![feature(doc_auto_cfg, doc_cfg)]

#[doc(inline)]
#[cfg(feature = "raw")]
pub use crate::raw::*;

I expected to see this happen:

image

The doc_cfg note would appear on the reexported items.

Instead, this happened:

The doc_cfg note does not appear on glob reexported items. If items are reexported individually, the doc_cfg note does apply.

(My actual case has a #[cfg(feature = "raw") on a containing module, and then #[cfg(feature = "lib")] on the glob reexport. The cfg note for raw always appears, but "and lib" only appears for explicitly named items.)

Meta

rustc -Vv && rustdoc -Vv:

rustc 1.62.0-nightly (e7575f967 2022-04-14)
binary: rustc
commit-hash: e7575f9670f3c837def3d186ae09366c75c7632e
commit-date: 2022-04-14
host: x86_64-pc-windows-msvc
release: 1.62.0-nightly
LLVM version: 14.0.0

rustdoc 1.62.0-nightly (e7575f967 2022-04-14)
binary: rustdoc
commit-hash: e7575f9670f3c837def3d186ae09366c75c7632e
commit-date: 2022-04-14
host: x86_64-pc-windows-msvc
release: 1.62.0-nightly
LLVM version: 14.0.0

@rustbot modify labels: +A-rustdoc-ui +requires-nightly
(I think?)

Activity

  1. added
    A-rustdoc-uiArea: Rustdoc UI (generated HTML)
    requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.
    on Apr 18, 2022
  2. CAD97 commented on Apr 18, 2022

    @CAD97
    ContributorAuthor

    @rustbot label +T-rustdoc
    (again, maybe?)

  3. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    on Apr 18, 2022
  4. mejrs commented on Apr 19, 2022

    @mejrs
    Member

    This looks like #83428

  5. CAD97 commented on Apr 19, 2022

    @CAD97
    ContributorAuthor

    This is likely the same root issue, but is a different expression of the issue; in #83428 the cfg is present for the source item as well, but I'm applying the cfg to just the reëxport.

  6. added a commit that references this issue on May 30, 2026
  7. added a commit that references this issue on May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)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.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions