about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2020-11-22 16:15:13 +0100
committerGitHub <noreply@github.com>2020-11-22 16:15:13 +0100
commit70a839fd8f279b05e365bb41541c90ecb4a8f51a (patch)
tree6e7e5cfd596648b4797712372a32a13cb5a88cb8
parent5c982b7ca219dba478a455e0c5e169a0f14b20a8 (diff)
parent28a94a3ae5a4149bdc3e795a1893b58f58913636 (diff)
Rollup merge of #79300 - GuillaumeGomez:hidden-feature-info, r=jyn514
Prevent feature information to be hidden if it's on the impl directly

Fixes #79279.

So when a `#[doc(cfg...)]` is used on a trait impl directly, it's not hidden by the toggle.

![Screenshot from 2020-11-22 14-40-11](https://user-images.githubusercontent.com/3050060/99905528-997fab00-2cd1-11eb-83be-ed06b0cb97df.png)

r? `@jyn514`
-rw-r--r--src/librustdoc/html/static/main.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index b8377dc1569..b11bd667093 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -2332,12 +2332,18 @@ function defocusSearchBar() {
             var dontApplyBlockRule = toggle.parentNode.parentNode.id !== "main";
             if (action === "show") {
                 removeClass(relatedDoc, "fns-now-collapsed");
-                removeClass(docblock, "hidden-by-usual-hider");
+                // Stability information is never hidden.
+                if (hasClass(docblock, "stability") === false) {
+                    removeClass(docblock, "hidden-by-usual-hider");
+                }
                 onEachLazy(toggle.childNodes, adjustToggle(false, dontApplyBlockRule));
                 onEachLazy(relatedDoc.childNodes, implHider(false, dontApplyBlockRule));
             } else if (action === "hide") {
                 addClass(relatedDoc, "fns-now-collapsed");
-                addClass(docblock, "hidden-by-usual-hider");
+                // Stability information should be shown even when detailed info is hidden.
+                if (hasClass(docblock, "stability") === false) {
+                    addClass(docblock, "hidden-by-usual-hider");
+                }
                 onEachLazy(toggle.childNodes, adjustToggle(true, dontApplyBlockRule));
                 onEachLazy(relatedDoc.childNodes, implHider(true, dontApplyBlockRule));
             }