Skip to content

Doc feature banners won't show up when re-exporting items with wildcard #113982

@rodrigocfd

Description

@rodrigocfd

Problem

I'm building a big library crate, composed of multiple sub-crates. These sub-crates are gated through Cargo features, so the user can choose what to import.

My goal is to have "fruits" and "colors" feature banners in the docs, for each item, like this:

banners

However, I'm only achieving this by manually declaring each member of each sub-crate:

#[cfg(feature = "colors")]
pub use colors::{
    blue,
    red,
    white,
};

#[cfg(feature = "fruits")]
pub use fruits::{
    banana,
    grape,
};

There will be hundreds of declarations, so this is very error-prone. When using wildcards to the declare the members, the feature banners won't show up:

no-banners

#[cfg(feature = "colors")]
pub use colors::*;

#[cfg(feature = "fruits")]
pub use fruits::*;

Is this a bug or am I missing something?

Minimal reproducible example:

Steps

  1. Generate the docs with:
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --no-deps -p big-lib

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.71.0 (cfd3bbd8f 2023-06-08)
release: 1.71.0
commit-hash: cfd3bbd8fe4fd92074dfad04b7eb9a923646839f
commit-date: 2023-06-08
host: x86_64-pc-windows-msvc
libgit2: 1.6.4 (sys:0.17.1 vendored)
libcurl: 8.0.1-DEV (sys:0.4.61+curl-8.0.1 vendored ssl:Schannel)
os: Windows 10.0.19045 (Windows 10 Pro) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

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