diff options
| author | bors <bors@rust-lang.org> | 2021-04-23 21:03:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-04-23 21:03:57 +0000 |
| commit | bb491ed23937aef876622e4beb68ae95938b3bf9 (patch) | |
| tree | d5383a2182442ee9c2dd0b0dae79dc04a2c98bc4 /src | |
| parent | 481ba16439299eb07058a7107352c558fdba7f96 (diff) | |
| parent | 62db03cd623c0c3a6cf13a1b8c3c13581a416fcc (diff) | |
| download | rust-bb491ed23937aef876622e4beb68ae95938b3bf9.tar.gz rust-bb491ed23937aef876622e4beb68ae95938b3bf9.zip | |
Auto merge of #84490 - JohnTitor:rollup-wrdj4ko, r=JohnTitor
Rollup of 11 pull requests Successful merges: - #80805 (Improve `Iterator::by_ref` example) - #84248 (Remove duplicated fn(Box<[T]>) -> Vec<T>) - #84321 (rustdoc: Convert sub-variant toggle to HTML) - #84359 (:arrow_up: rust-analyzer) - #84374 (Clean up .gitignore) - #84387 (Move `sys_common::poison` to `sync::poison`) - #84430 (doc/platform-support: clarify UEFI support) - #84433 (Prevent control, shift and alt keys to make search input lose focus) - #84444 (doc: Get rid of "[+] show undocumented items" toggle on numeric From impls) - #84456 (Fix ICE if original_span(fn_sig) returns a span not in body sourcefile) - #84469 (Update comment on `PrimTy::name_str`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/rustc/src/platform-support.md | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/render/print_item.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/static/main.js | 16 | ||||
| -rw-r--r-- | src/librustdoc/html/static/rustdoc.css | 5 | ||||
| -rw-r--r-- | src/librustdoc/html/static/search.js | 9 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/lib.rs | 8 | ||||
| -rw-r--r-- | src/test/rustdoc/item-hide-threshold.rs | 3 | ||||
| m--------- | src/tools/rust-analyzer | 35 |
8 files changed, 51 insertions, 31 deletions
diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index f352746d3fb..25b56b96ed2 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -179,7 +179,7 @@ target | std | host | notes `i386-apple-ios` | ✓ | | 32-bit x86 iOS `i686-apple-darwin` | ✓ | ✓ | 32-bit macOS (10.7+, Lion+) `i686-pc-windows-msvc` | ✓ | | 32-bit Windows XP support -`i686-unknown-uefi` | ? | | 32-bit UEFI +`i686-unknown-uefi` | * | | 32-bit UEFI `i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku `i686-unknown-netbsd` | ✓ | ✓ | NetBSD/i386 with SSE2 `i686-unknown-openbsd` | ✓ | ✓ | 32-bit OpenBSD @@ -228,7 +228,7 @@ target | std | host | notes `x86_64-unknown-none-hermitkernel` | ? | | HermitCore kernel `x86_64-unknown-l4re-uclibc` | ? | | `x86_64-unknown-openbsd` | ✓ | ✓ | 64-bit OpenBSD -`x86_64-unknown-uefi` | ? | | +`x86_64-unknown-uefi` | * | | 64-bit UEFI `x86_64-uwp-windows-gnu` | ✓ | | `x86_64-uwp-windows-msvc` | ✓ | | `x86_64-wrs-vxworks` | ? | | diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index a303ca956d8..9d7d8a7cb8a 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -963,6 +963,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum use crate::clean::Variant; if let clean::VariantItem(Variant::Struct(ref s)) = *variant.kind { + toggle_open(w, "fields"); let variant_id = cx.derive_id(format!( "{}.{}.fields", ItemType::Variant, @@ -996,6 +997,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum } } w.write_str("</div></div>"); + toggle_close(w); } render_stability_since(w, variant, it, cx.tcx()); } diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index be8d0a5996f..5dfc206eb2e 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -455,6 +455,15 @@ function hideThemeButtonState() { handleHashes(ev); } + function openParentDetails(elem) { + while (elem) { + if (elem.tagName === "DETAILS") { + elem.open = true; + } + elem = elem.parentNode; + } + } + function expandSection(id) { var elem = document.getElementById(id); if (elem && isHidden(elem)) { @@ -469,6 +478,8 @@ function hideThemeButtonState() { // The element is not visible, we need to make it appear! collapseDocs(collapses[0], "show"); } + // Open all ancestor <details> to make this element visible. + openParentDetails(h3.parentNode); } } } @@ -1009,7 +1020,7 @@ function hideThemeButtonState() { if (hasClass(relatedDoc, "item-info")) { relatedDoc = relatedDoc.nextElementSibling; } - if (hasClass(relatedDoc, "docblock") || hasClass(relatedDoc, "sub-variant")) { + if (hasClass(relatedDoc, "docblock")) { if (mode === "toggle") { if (hasClass(relatedDoc, "hidden-by-usual-hider")) { action = "show"; @@ -1318,8 +1329,6 @@ function hideThemeButtonState() { if (hasClass(e, "type-decl")) { // We do something special for these return; - } else if (hasClass(e, "sub-variant")) { - otherMessage = " Show fields"; } else if (hasClass(e, "non-exhaustive")) { otherMessage = " This "; if (hasClass(e, "non-exhaustive-struct")) { @@ -1351,7 +1360,6 @@ function hideThemeButtonState() { } onEachLazy(document.getElementsByClassName("docblock"), buildToggleWrapper); - onEachLazy(document.getElementsByClassName("sub-variant"), buildToggleWrapper); autoCollapse(getSettingValue("collapse") === "true"); diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 213ca9ec9e3..44fb531100a 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -1046,10 +1046,11 @@ h3 > .collapse-toggle, h4 > .collapse-toggle { } .sub-variant, .sub-variant > h3 { - margin-top: 1px !important; + margin-top: 0px !important; + padding-top: 1px; } -#main > .sub-variant > h3 { +#main > details > .sub-variant > h3 { font-size: 15px; margin-left: 25px; margin-bottom: 5px; diff --git a/src/librustdoc/html/static/search.js b/src/librustdoc/html/static/search.js index eb232a96081..9fab435de49 100644 --- a/src/librustdoc/html/static/search.js +++ b/src/librustdoc/html/static/search.js @@ -935,6 +935,9 @@ window.initSearch = function(rawSearchIndex) { }); current += 1; }); + var SHIFT = 16; + var CTRL = 17; + var ALT = 18; var currentTab = searchState.currentTab; if (e.which === 38) { // up @@ -967,10 +970,10 @@ window.initSearch = function(rawSearchIndex) { e.preventDefault(); } else if (e.which === 13) { // return if (actives[currentTab].length) { - document.location.href = - actives[currentTab][0].getElementsByTagName("a")[0].href; + var elem = actives[currentTab][0].getElementsByTagName("a")[0]; + document.location.href = elem.href; } - } else if (e.which === 16) { // shift + } else if ([SHIFT, CTRL, ALT].indexOf(e.which) !== -1) { // Does nothing, it's just to avoid losing "focus" on the highlighted element. } else if (actives[currentTab].length > 0) { removeClass(actives[currentTab][0], "highlighted"); diff --git a/src/test/rustdoc-gui/lib.rs b/src/test/rustdoc-gui/lib.rs index c1e161e1235..eeba3e3f907 100644 --- a/src/test/rustdoc-gui/lib.rs +++ b/src/test/rustdoc-gui/lib.rs @@ -29,7 +29,9 @@ pub struct Foo; impl Foo { #[must_use] - pub fn must_use(&self) -> bool { true } + pub fn must_use(&self) -> bool { + true + } } /// Just a normal enum. @@ -85,3 +87,7 @@ pub trait AnotherOne { /// let x = 12; /// ``` pub fn check_list_code_block() {} + +pub enum AnEnum { + WithVariants { and: usize, sub: usize, variants: usize }, +} diff --git a/src/test/rustdoc/item-hide-threshold.rs b/src/test/rustdoc/item-hide-threshold.rs index 616eef95662..8986f72636a 100644 --- a/src/test/rustdoc/item-hide-threshold.rs +++ b/src/test/rustdoc/item-hide-threshold.rs @@ -62,7 +62,8 @@ pub struct PrivStruct { } // @has 'item_hide_threshold/enum.Enum.html' -// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 0 +// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1 +// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show fields' pub enum Enum { A, B, C, D { diff --git a/src/tools/rust-analyzer b/src/tools/rust-analyzer -Subproject 7be06139b632ee615fc18af04dd67947e2c794b +Subproject 7570212a544b8e973a7d57be3657aae6465028a |
