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

"Auto-hide trait implementation documentation" does nothing #85411

Closed
Nemo157 opened this issue May 17, 2021 · 4 comments · Fixed by #85575
Closed

"Auto-hide trait implementation documentation" does nothing #85411

Nemo157 opened this issue May 17, 2021 · 4 comments · Fixed by #85575
Labels
A-rustdoc-js Area: Rustdoc's JS front-end C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Milestone

Comments

@Nemo157
Copy link
Member

Nemo157 commented May 17, 2021

beta and nightly ignore the default-on configuration of "Auto-hide trait implementation documentation"

On stable std::future::Pending looks like:

image

While on beta it looks like:

image

And on nightly (as of 2021-05-17):

image

Going to https://doc.rust-lang.org/nightly/settings.html and toggling "Auto-hide trait implementation documentation" off makes stable look the same as beta, so it definitely seems like beta/nightly are just ignoring this toggle.

@Nemo157 Nemo157 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. C-bug Category: This is a bug. A-rustdoc-js Area: Rustdoc's JS front-end labels May 17, 2021
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label May 17, 2021
@jyn514 jyn514 added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label May 18, 2021
@Mark-Simulacrum Mark-Simulacrum added this to the 1.53.0 milestone May 18, 2021
@jsha
Copy link
Contributor

jsha commented May 19, 2021

This is due to the refactoring we've been doing with the expand / collapse toggles, wrapping them in <details> tags. The code that expands and collapses them based on settings is here:

var hideMethodDocs = getSettingValue("auto-hide-method-docs") === "true";
var hideImplementors = getSettingValue("auto-collapse-implementors") !== "false";
var hideLargeItemContents = getSettingValue("auto-hide-large-items") !== "false";

if (hideMethodDocs) {
onEachLazy(document.getElementsByClassName("method"), function(e) {
var toggle = e.parentNode;
if (toggle) {
toggle = toggle.parentNode;
}
if (toggle && toggle.tagName === "DETAILS") {
toggle.open = false;
}
});
}
onEachLazy(document.getElementsByTagName("details"), function (e) {
var showLargeItem = !hideLargeItemContents && hasClass(e, "type-contents-toggle");
var showImplementor = !hideImplementors && hasClass(e, "implementors-toggle");
if (showLargeItem || showImplementor) {
e.open = true;
}
});

You can see there's an entry for handling "implementors" but not one for "implementations."

Right now, both implementors and implementations get wrapped in a <details> tag with class=toggle-implementors. We need to update this Rust code:

let open_details = |close_tags: &mut String| {
if toggled {
close_tags.insert_str(0, "</details>");
"<details class=\"rustdoc-toggle implementors-toggle\" open><summary>"
} else {
""
}
};

So that it generates toggle-implementors for implementors and toggle-implementations for implementations. And then update the JS to add a clause for implementations.

@apiraino
Copy link
Contributor

Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels May 19, 2021
@jsha
Copy link
Contributor

jsha commented May 20, 2021

I'm having trouble figuring out what fields to check in render_impl to figure out if we're rendering an implementor or an implementation. If someone's able to point me in the right direction I'd appreciate it!

@GuillaumeGomez
Copy link
Member

Well, I think I handled it in #85548 (funny that I was noticed it and fixed it on my side and someone else find it out too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-js Area: Rustdoc's JS front-end C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. 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.

7 participants