Skip to content

Inconsistent default display of doc(cfg(...)) on impls of empty traits #79279

Closed
@dtolnay

Description

@dtolnay
#![feature(doc_cfg)]

pub struct S;

#[doc(cfg(feature = "traits"))]
impl Eq for S {}

#[doc(cfg(feature = "traits"))]
impl PartialEq for S {
    fn eq(&self, _rhs: &Self) -> bool {
        true
    }
}

cargo doc renders this as follows. Notice that the blue banner appears for Eq (I guess because the trait is empty) but not for PartialEq. I believe that it should consistently appear for neither Eq nor PartialEq, or both Eq and PartialEq.


Expanding the [+] next to impl PartialEq shows the other blue banner but this issue is about the default appearance on page load.


Mentioning doc(cfg(...)) tracking issue #43781.
Mentioning @GuillaumeGomez @Nemo157

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemC-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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions