-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-cross-crate-reexportsArea: Documentation that has been re-exported from a different crateArea: Documentation that has been re-exported from a different crateA-rustdoc-uiArea: Rustdoc UI (generated HTML)Area: Rustdoc UI (generated HTML)C-bugCategory: This is a bug.Category: This is a bug.F-doc_cfg`#![feature(doc_cfg)]``#![feature(doc_cfg)]`T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
Hard to put in words the kind of mess that the situation currently seems to be…
Let’s just look at an example:
#![feature(doc_cfg)]
/// A module called `local_io`
pub mod local_io {}
#[doc(cfg(feature = "foo"))]
/// A module called `local_cfg_io`
pub mod local_cfg_io {}
pub mod m {
#[doc(inline)]
pub use std::io as io1;
#[doc(no_inline)]
pub use std::io as io2;
#[doc(cfg(feature = "foo"), inline)]
pub use std::io as io3;
#[doc(cfg(feature = "foo"), no_inline)]
pub use std::io as io4;
#[doc(inline)]
pub use crate::local_io as local_io1;
#[doc(no_inline)]
pub use crate::local_io as local_io2;
#[doc(cfg(feature = "foo"), inline)]
pub use crate::local_io as local_io3;
#[doc(cfg(feature = "foo"), no_inline)]
pub use crate::local_io as local_io4;
#[doc(inline)]
pub use crate::local_cfg_io as local_cfg_io1;
#[doc(no_inline)]
pub use crate::local_cfg_io as local_cfg_io2;
#[doc(cfg(feature = "foo"), inline)]
pub use crate::local_cfg_io as local_cfg_io3;
#[doc(cfg(feature = "foo"), no_inline)]
pub use crate::local_cfg_io as local_cfg_io4;
}
Resulting docs of module m
:
Bug description
As you can see above, the cfg(feature = "foo")
is mostly ignored on the pub use
items. Only external items with inline
take that attribute into account.
Expected behavior
I would probably expect that the rendered cfg
label on a re-export only depends on cfg(doc(…))
attributes on the pub use
itself. For a no_inline
item, this would mean that the label in the “Re-exports” list might differ from the label you see on the item itself once you click on it; maybe we want a more clear way to distinguish the cfg
of the pub use
from the cfg
of the used item.
@rustbot label A-rustdoc-ui, F-doc_cfg, requires-nightly
newAM and joseluis
Metadata
Metadata
Assignees
Labels
A-cross-crate-reexportsArea: Documentation that has been re-exported from a different crateArea: Documentation that has been re-exported from a different crateA-rustdoc-uiArea: Rustdoc UI (generated HTML)Area: Rustdoc UI (generated HTML)C-bugCategory: This is a bug.Category: This is a bug.F-doc_cfg`#![feature(doc_cfg)]``#![feature(doc_cfg)]`T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.