Skip to content

rustdoc: doc_cfg on trait impls needs more visibility #68100

Closed
@yaahc

Description

@yaahc

I'm trying to annotate all the parts of a crate that are available based on feature flags and I've had the following experience when annotating a trait impl.

#[cfg(feature = "registry")]
#[cfg_attr(docsrs, doc(cfg(feature = "registry")))]
impl<'a, L, S> LookupSpan<'a> for Layered<L, S>
where
    S: Subscriber + LookupSpan<'a>,
{
    type Data = S::Data;

    fn span_data(&'a self, id: &span::Id) -> Option<Self::Data> {
        self.inner.span_data(id)
    }
}

This is what it looks like with the default visibility

Screenshot from 2020-01-10 11-07-39

After expanding a single [+]

Screenshot from 2020-01-10 11-07-48

Fully expanded

Screenshot from 2020-01-10 11-08-00

Ideally the default visibility with everything minimized should still indicate that this trait impl is dependent upon the given feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.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