From 2c4ecffb7758b93c6471efc0f1880b57577f6f5d Mon Sep 17 00:00:00 2001 From: Ezra Shaw Date: Fri, 30 Dec 2022 14:24:12 +1300 Subject: [PATCH 1/5] docs: add link to `Path::join` in `PathBuf::push` --- library/std/src/path.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 73b5056e93267..999f5d3a93f26 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -1246,6 +1246,9 @@ impl PathBuf { /// and `path` is not empty, the new path is normalized: all references /// to `.` and `..` are removed. /// + /// Consider using [`Path::join`] if you need a new `PathBuf` instead of + /// using this function on a cloned `PathBuf`. + /// /// # Examples /// /// Pushing a relative path extends the existing path: From ac0bb74adb9e40a71f716d330a1245cd7e86c3eb Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 30 Dec 2022 10:43:06 -0700 Subject: [PATCH 2/5] rustdoc: merge scrape-help CSS --- src/librustdoc/html/static/css/rustdoc.css | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 9fe0dee058830..83d62c376631a 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1865,9 +1865,13 @@ in storage.js font-size: 12px; position: relative; bottom: 1px; - border-width: 1px; - border-style: solid; + border: 1px solid var(--scrape-example-help-border-color); border-radius: 50px; + color: var(--scrape-example-help-color); +} +.scraped-example-list .scrape-help:hover { + border-color: var(--scrape-example-help-hover-border-color); + color: var(--scrape-example-help-hover-color); } .scraped-example { @@ -1959,14 +1963,6 @@ in storage.js .scraped-example .example-wrap .rust span.highlight.focus { background: var(--scrape-example-code-line-highlight-focus); } -.scraped-example-list .scrape-help { - border-color: var(--scrape-example-help-border-color); - color: var(--scrape-example-help-color); -} -.scraped-example-list .scrape-help:hover { - border-color: var(--scrape-example-help-hover-border-color); - color: var(--scrape-example-help-hover-color); -} .more-examples-toggle { max-width: calc(100% + 25px); From b542f28d9ba480cef8355c94b847599619bff1ef Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 31 Dec 2022 11:15:02 +0100 Subject: [PATCH 3/5] Add comment explaining what the GUI scrape-examples-fonts test is about --- src/test/rustdoc-gui/scrape-examples-fonts.goml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/rustdoc-gui/scrape-examples-fonts.goml b/src/test/rustdoc-gui/scrape-examples-fonts.goml index b7d7f4ccb4ae6..142f337cb74e4 100644 --- a/src/test/rustdoc-gui/scrape-examples-fonts.goml +++ b/src/test/rustdoc-gui/scrape-examples-fonts.goml @@ -1,3 +1,4 @@ +// This test ensures that the correct font is used in scraped examples. goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" store-value: (font, '"Fira Sans", Arial, NanumBarunGothic, sans-serif') From 4620f82a13adce6c324baa6ed77dce511a586504 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 31 Dec 2022 11:52:16 -0800 Subject: [PATCH 4/5] Fix tidy unittest. --- src/tools/tidy/src/features/version/tests.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/tidy/src/features/version/tests.rs b/src/tools/tidy/src/features/version/tests.rs index 31224fdf1eacf..7701dce2df173 100644 --- a/src/tools/tidy/src/features/version/tests.rs +++ b/src/tools/tidy/src/features/version/tests.rs @@ -12,8 +12,8 @@ fn test_try_from_invalid_version() { #[test] fn test_try_from_single() { - assert_eq!("1.32.0".parse(), Ok(Version { parts: [1, 32, 0] })); - assert_eq!("1.0.0".parse(), Ok(Version { parts: [1, 0, 0] })); + assert_eq!("1.32.0".parse(), Ok(Version::Explicit { parts: [1, 32, 0] })); + assert_eq!("1.0.0".parse(), Ok(Version::Explicit { parts: [1, 0, 0] })); } #[test] From 59b80f598fd983a3800d6f2ffd23f0a5a89c3f4f Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 31 Dec 2022 12:31:42 -0800 Subject: [PATCH 5/5] Run `cargo test` on tidy itself. --- src/bootstrap/builder.rs | 1 + src/bootstrap/test.rs | 34 +++++++++++++++++++ .../host-x86_64/mingw-check-tidy/Dockerfile | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 66bc0f023b6c9..b54bf43262198 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -662,6 +662,7 @@ impl<'a> Builder<'a> { crate::toolstate::ToolStateCheck, test::ExpandYamlAnchors, test::Tidy, + test::TidySelfTest, test::Ui, test::RunPassValgrind, test::MirOpt, diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index d5bec268a4567..ea906be7e3ac2 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1143,6 +1143,40 @@ help: to skip test's attempt to check tidiness, pass `--exclude src/tools/tidy` } } +/// Runs tidy's own tests. +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct TidySelfTest; + +impl Step for TidySelfTest { + type Output = (); + const DEFAULT: bool = true; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.alias("tidyselftest") + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(TidySelfTest); + } + + fn run(self, builder: &Builder<'_>) { + let bootstrap_host = builder.config.build; + let compiler = builder.compiler(0, bootstrap_host); + let cargo = tool::prepare_tool_cargo( + builder, + compiler, + Mode::ToolBootstrap, + bootstrap_host, + "test", + "src/tools/tidy", + SourceType::InTree, + &[], + ); + try_run(builder, &mut cargo.into()); + } +} + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct ExpandYamlAnchors; diff --git a/src/ci/docker/host-x86_64/mingw-check-tidy/Dockerfile b/src/ci/docker/host-x86_64/mingw-check-tidy/Dockerfile index 78fee152eb9d4..c340294fc7375 100644 --- a/src/ci/docker/host-x86_64/mingw-check-tidy/Dockerfile +++ b/src/ci/docker/host-x86_64/mingw-check-tidy/Dockerfile @@ -33,4 +33,4 @@ COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/ COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/ ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1 -ENV SCRIPT python3 ../x.py test --stage 0 src/tools/tidy +ENV SCRIPT python3 ../x.py test --stage 0 src/tools/tidy tidyselftest