From c3329ba63a8ee9f361bec72dc90b97be93e0ca11 Mon Sep 17 00:00:00 2001 From: "Keith T. Star" Date: Mon, 12 Dec 2022 16:22:01 -0700 Subject: [PATCH 1/6] Minor grammar nit. --- library/core/src/borrow.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/borrow.rs b/library/core/src/borrow.rs index fdd56cb4eaa8e..4a8302ee404c1 100644 --- a/library/core/src/borrow.rs +++ b/library/core/src/borrow.rs @@ -26,7 +26,7 @@ /// to be modified, it can additionally implement [`BorrowMut`]. /// /// Further, when providing implementations for additional traits, it needs -/// to be considered whether they should behave identical to those of the +/// to be considered whether they should behave identically to those of the /// underlying type as a consequence of acting as a representation of that /// underlying type. Generic code typically uses `Borrow` when it relies /// on the identical behavior of these additional trait implementations. From b037c4447f15faa1d6bcb17279558292e3cd82e8 Mon Sep 17 00:00:00 2001 From: tronta Date: Tue, 13 Dec 2022 13:18:08 +0100 Subject: [PATCH 2/6] Update RELEASES.md this is not yet supported: ..X => https://github.com/rust-lang/rust/issues/37854 is still open --- RELEASES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASES.md b/RELEASES.md index 5b4d6ccd9b8b8..770dee7b54616 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -16,7 +16,7 @@ Language - [Change constant evaluation errors from a deny-by-default lint to a hard error](https://github.com/rust-lang/rust/pull/102091/) - [Trigger `must_use` on `impl Trait` for supertraits](https://github.com/rust-lang/rust/pull/102287/) This makes `impl ExactSizeIterator` respect the existing `#[must_use]` annotation on `Iterator`. -- [Allow `..X` and `..=X` in patterns](https://github.com/rust-lang/rust/pull/102275/) +- [Allow `..=X` in patterns](https://github.com/rust-lang/rust/pull/102275/) - [Uplift `clippy::for_loops_over_fallibles` lint into rustc](https://github.com/rust-lang/rust/pull/99696/) - [Stabilize `sym` operands in inline assembly](https://github.com/rust-lang/rust/pull/103168/) - [Update to Unicode 15](https://github.com/rust-lang/rust/pull/101912/) From c14b85c11e15006d41a637448df8fed7a78fe5c6 Mon Sep 17 00:00:00 2001 From: Andrew Pollack Date: Tue, 13 Dec 2022 09:26:12 -0800 Subject: [PATCH 3/6] Adjust log line in `fuchsia-test-runner.py` * Adjusting log line in `fuchsia-test-runner.py` to refer to self --- src/ci/docker/scripts/fuchsia-test-runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/scripts/fuchsia-test-runner.py b/src/ci/docker/scripts/fuchsia-test-runner.py index a2708d16947f0..3e86339859dd3 100755 --- a/src/ci/docker/scripts/fuchsia-test-runner.py +++ b/src/ci/docker/scripts/fuchsia-test-runner.py @@ -346,7 +346,7 @@ def start(self): "-f", self.ssh_keyfile_path(), "-C", - "Generated by test_toolchain.py", + "Generated by fuchsia-test-runner.py", ], stdout=self.subprocess_output(), stderr=self.subprocess_output(), From e38d1e909a43767fd5330802acf33b92e3bbdbb3 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 13 Dec 2022 10:46:27 -0700 Subject: [PATCH 4/6] rustdoc: apply `pre-wrap` CSS to code-wrapped links This is common syntax used for intra-doc links, so fixing it should help with doc formatting. --- src/librustdoc/html/static/css/rustdoc.css | 4 ++-- src/test/rustdoc-gui/docblock-big-code-mobile.goml | 4 ++++ src/test/rustdoc-gui/src/test_docs/lib.rs | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index d22d2f2edb038..572a5b42c7f33 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -585,8 +585,8 @@ ul.block, .block li { text-overflow: ellipsis; } /* Wrap non-pre code blocks (`text`) but not (```text```). */ -.docblock > :not(pre) > code, -.docblock-short > code { +.docblock :not(pre) > code, +.docblock-short code { white-space: pre-wrap; } diff --git a/src/test/rustdoc-gui/docblock-big-code-mobile.goml b/src/test/rustdoc-gui/docblock-big-code-mobile.goml index 9f8df44d762ce..3ce921c2c91cb 100644 --- a/src/test/rustdoc-gui/docblock-big-code-mobile.goml +++ b/src/test/rustdoc-gui/docblock-big-code-mobile.goml @@ -7,3 +7,7 @@ show-text: true // We need to enable text draw to be able to have the "real" siz // Little explanations for this test: if the text wasn't displayed on two lines, it would take // around 20px (which is the font size). assert-property: (".docblock p > code", {"offsetHeight": "44"}) + +// Same check, but where the long code block is also a link +goto: "file://" + |DOC_PATH| + "/test_docs/long_code_block_link/index.html" +assert-property: (".docblock p > a > code", {"offsetHeight": "44"}) diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index d6eeab803dfec..f55b9ec3af515 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -154,6 +154,11 @@ pub mod huge_amount_of_consts { /// Very long code text `hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`. pub mod long_code_block {} +/// Very long code text [`hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`][lnk]. +/// +/// [lnk]: crate::long_code_block_link +pub mod long_code_block_link {} + #[macro_export] macro_rules! repro { () => {}; From 813584950dbdf180eae2fb64cbf009073a3c8d43 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 13 Dec 2022 11:00:34 -0700 Subject: [PATCH 5/6] rustdoc: simplify popover CSS * Merge the color-changing block into the regular rules, which was probably written that way because it used to be in the theme files, but has no reason to be written this way now that it's in rustdoc.css * Get rid of redundant `display: block`, since `position: absolute` blockifies the layout anyway. --- src/librustdoc/html/static/css/rustdoc.css | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index d22d2f2edb038..7189437bbaa54 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -902,10 +902,11 @@ so that we can apply CSS-filters to change the arrow color in themes */ top: 100%; right: 0; z-index: 2; - display: block; margin-top: 7px; border-radius: 3px; border: 1px solid var(--border-color); + background-color: var(--main-background-color); + color: var(--main-color); --popover-arrow-offset: 11px; } @@ -916,16 +917,12 @@ so that we can apply CSS-filters to change the arrow color in themes */ right: var(--popover-arrow-offset); border: solid var(--border-color); border-width: 1px 1px 0 0; + background-color: var(--main-background-color); padding: 4px; transform: rotate(-45deg); top: -5px; } -.popover, .popover::before { - background-color: var(--main-background-color); - color: var(--main-color); -} - /* use larger max-width for help popover, but not for help.html */ #help.popover { max-width: 600px; From 79bb6ec9ef9490ba74bce0c481d693c1d88db4b4 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 13 Dec 2022 16:55:45 -0700 Subject: [PATCH 6/6] rustdoc: add CSS margin between `impl` docblock and its items --- src/librustdoc/html/static/css/rustdoc.css | 1 + src/test/rustdoc-gui/impl-doc.goml | 9 +++++++++ src/test/rustdoc-gui/src/test_docs/lib.rs | 8 ++++++++ 3 files changed, 18 insertions(+) create mode 100644 src/test/rustdoc-gui/impl-doc.goml diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index d22d2f2edb038..210f1de887964 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1872,6 +1872,7 @@ in storage.js } .variants > .docblock, +.implementors-toggle > .docblock, .impl-items > .rustdoc-toggle[open]:not(:last-child), .methods > .rustdoc-toggle[open]:not(:last-child), .implementors-toggle[open]:not(:last-child) { diff --git a/src/test/rustdoc-gui/impl-doc.goml b/src/test/rustdoc-gui/impl-doc.goml new file mode 100644 index 0000000000000..7322032b3f5f7 --- /dev/null +++ b/src/test/rustdoc-gui/impl-doc.goml @@ -0,0 +1,9 @@ +// A docblock on an impl must have a margin to separate it from the contents. +goto: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithImplDoc.html" + +// The text is about 24px tall, so if there's a margin, then their position will be >24px apart +compare-elements-position-near-false: ( + "#implementations-list > .implementors-toggle > .docblock > p", + "#implementations-list > .implementors-toggle > .impl-items", + {"y": 24} +) diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index d6eeab803dfec..902c10ef5b676 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -442,3 +442,11 @@ pub mod trait_members { fn function2() {} } } + +pub struct TypeWithImplDoc; + +/// impl doc +impl TypeWithImplDoc { + /// fn doc + pub fn test_fn() {} +}