Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dtolnay opened this issue Nov 21, 2020 · 5 comments · Fixed by #79300
Closed

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

dtolnay opened this issue Nov 21, 2020 · 5 comments · Fixed by #79300
Labels
A-traits Area: Trait system C-bug Category: This is a bug. F-doc_cfg `#![feature(doc_cfg)]` T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@dtolnay
Copy link
Member

dtolnay commented Nov 21, 2020

#![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

@dtolnay dtolnay added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Nov 21, 2020
@jyn514 jyn514 added A-traits Area: Trait system F-doc_cfg `#![feature(doc_cfg)]` labels Nov 21, 2020
@Nemo157
Copy link
Member

Nemo157 commented Nov 21, 2020

Ohh, the collapse settings are fun; I never noticed this in #78678 because I have rustdoc-collapse: true which seems to imply not collapsing the trait implementations. Clearing that setting from local storage, or if it's set to false does this; I think it should be possible to make it so that having this block there either ignores collapsing so it shows always, (though this may be inconsistent with how it works with functions), or make it default to uncollapsing the trait.

@Nemo157
Copy link
Member

Nemo157 commented Nov 21, 2020

(Something else to check at the same time: what happens with JS disabled)

@GuillaumeGomez
Copy link
Member

Nothing is collapsed when JS is disabled. :)

I'll take a look tomorrow.

@Nemo157
Copy link
Member

Nemo157 commented Nov 21, 2020

Nothing is collapsed when JS is disabled. :)

The [+] Show hidden undocumented items toggle, and the items it toggles, are hidden when JS is disabled.

@GuillaumeGomez
Copy link
Member

Hum... I suppose it's a new issue then. Something to add in noscript.css.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-traits Area: Trait system C-bug Category: This is a bug. F-doc_cfg `#![feature(doc_cfg)]` T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants