You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that after enabling doc_auto_cfg on a crate on docs.rs, some impls are missing the badge showing that a feature flag is needed to get that impl. For example, this impl is only available with the std feature enabled.
I think this is due to those impls being in a separate module, where the whole module is gated with a cfg(feature = "std"). Here's a minimalish example:
# In Cargo.toml:
[features]
coolstuff = []
// In src/lib.rs:#![feature(doc_auto_cfg)]pubstructS;pubtraitMyTrait1{}pubtraitMyTrait2{}#[cfg(feature = "coolstuff")]implMyTrait1forS{}#[cfg(feature = "coolstuff")]mod submod {usecrate::{S,MyTrait2};implMyTrait2forS{}}
Build with cargo +nightly doc -F coolstuff --open, then navigate to the page for struct S.
Under the "Trait Implementations" section, I see both impl MyTrait1 for S and impl MyTrait2 for S as expected. I also expect both to have a badge saying "Available on crate feature coolstuff only", but instead only MyTrait1 shows this badge.
…_impl, r=notriddle
Fix doc_auto_cfg for impl blocks in different modules with different `cfg`
Fixesrust-lang#101129.
Just like reexports, impl blocks don't necessarily share the same "space" as the item they implement so we need to merge attributes from its parents as well.
r? `@notriddle`
I noticed that after enabling
doc_auto_cfg
on a crate on docs.rs, some impls are missing the badge showing that a feature flag is needed to get that impl. For example, this impl is only available with thestd
feature enabled.I think this is due to those impls being in a separate module, where the whole module is gated with a
cfg(feature = "std")
. Here's a minimalish example:Build with
cargo +nightly doc -F coolstuff --open
, then navigate to the page forstruct S
.Under the "Trait Implementations" section, I see both
impl MyTrait1 for S
andimpl MyTrait2 for S
as expected. I also expect both to have a badge saying "Available on crate featurecoolstuff
only", but instead onlyMyTrait1
shows this badge.Meta
rustc +nightly --version --verbose
:The text was updated successfully, but these errors were encountered: