From 43bcc71d074a10d9186e27f9bf21b9dafa815bf5 Mon Sep 17 00:00:00 2001 From: kxxt Date: Wed, 21 Sep 2022 20:51:03 +0800 Subject: [PATCH 01/10] refactor: use grep -E/-F instead of fgrep/egrep --- src/etc/cat-and-grep.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/etc/cat-and-grep.sh b/src/etc/cat-and-grep.sh index 77dc52a935070..08de25a77783a 100755 --- a/src/etc/cat-and-grep.sh +++ b/src/etc/cat-and-grep.sh @@ -26,7 +26,7 @@ Options: -i Case insensitive search. ' -GREPPER=fgrep +GREPPER=grep INVERT=0 GREPFLAGS='q' while getopts ':vieh' OPTION; do @@ -39,7 +39,7 @@ while getopts ':vieh' OPTION; do GREPFLAGS="i$GREPFLAGS" ;; e) - GREPPER=egrep + GREPFLAGS="E$GREPFLAGS" ;; h) echo "$USAGE" @@ -51,6 +51,15 @@ while getopts ':vieh' OPTION; do esac done +# an utility function to check if a string contains a substring +stringContain() { [ -z "$1" ] || { [ -z "${2##*$1*}" ] && [ -n "$2" ];};} + +if ! stringContain 'E' "$GREPFLAGS" +then + # use F flag if there is not an E flag + GREPFLAGS="F$GREPFLAGS" +fi + shift $((OPTIND - 1)) # use gnu version of tool if available (for bsd) From 6135aff27cedcf81ff863715685808829364f7cb Mon Sep 17 00:00:00 2001 From: kxxt Date: Mon, 26 Sep 2022 21:56:08 +0800 Subject: [PATCH 02/10] simplify --- src/etc/cat-and-grep.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/etc/cat-and-grep.sh b/src/etc/cat-and-grep.sh index 08de25a77783a..238f7f5b66027 100755 --- a/src/etc/cat-and-grep.sh +++ b/src/etc/cat-and-grep.sh @@ -51,10 +51,7 @@ while getopts ':vieh' OPTION; do esac done -# an utility function to check if a string contains a substring -stringContain() { [ -z "$1" ] || { [ -z "${2##*$1*}" ] && [ -n "$2" ];};} - -if ! stringContain 'E' "$GREPFLAGS" +if ! echo "$GREPFLAGS" | grep -q E then # use F flag if there is not an E flag GREPFLAGS="F$GREPFLAGS" From 4cf30c0022a434718799b66cdf8911ad8030d0e1 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Fri, 7 Oct 2022 15:42:05 +0300 Subject: [PATCH 03/10] Improved documentation for `std::io::Error` --- library/std/src/io/error.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/std/src/io/error.rs b/library/std/src/io/error.rs index feb3fb989a7ac..2bbfbe38a24ae 100644 --- a/library/std/src/io/error.rs +++ b/library/std/src/io/error.rs @@ -481,6 +481,7 @@ impl Error { /// originate from the OS itself. The `error` argument is an arbitrary /// payload which will be contained in this [`Error`]. /// + /// Note that this function allocates memory on the heap. /// If no extra payload is required, use the `From` conversion from /// `ErrorKind`. /// @@ -495,7 +496,7 @@ impl Error { /// // errors can also be created from other errors /// let custom_error2 = Error::new(ErrorKind::Interrupted, custom_error); /// - /// // creating an error without payload + /// // creating an error without payload (also without memory allocation) /// let eof_error = Error::from(ErrorKind::UnexpectedEof); /// ``` #[stable(feature = "rust1", since = "1.0.0")] From b8418485bc400d5a00f197ff328655bfa367835e Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Thu, 13 Oct 2022 13:07:56 +0900 Subject: [PATCH 04/10] check if the self type is `ty::Float` before getting second substs --- .../src/traits/error_reporting/suggestions.rs | 22 +++--- src/test/ui/traits/issue-102989.rs | 18 +++++ src/test/ui/traits/issue-102989.stderr | 72 +++++++++++++++++++ 3 files changed, 99 insertions(+), 13 deletions(-) create mode 100644 src/test/ui/traits/issue-102989.rs create mode 100644 src/test/ui/traits/issue-102989.stderr diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index fda6a2236b195..4431cf9f4436b 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -2937,19 +2937,15 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ObligationCauseCode::BinOp { rhs_span: Some(span), is_lit, .. } if *is_lit => span, _ => return, }; - match ( - trait_ref.skip_binder().self_ty().kind(), - trait_ref.skip_binder().substs.type_at(1).kind(), - ) { - (ty::Float(_), ty::Infer(InferTy::IntVar(_))) => { - err.span_suggestion_verbose( - rhs_span.shrink_to_hi(), - "consider using a floating-point literal by writing it with `.0`", - ".0", - Applicability::MaybeIncorrect, - ); - } - _ => {} + if let ty::Float(_) = trait_ref.skip_binder().self_ty().kind() + && let ty::Infer(InferTy::IntVar(_)) = trait_ref.skip_binder().substs.type_at(1).kind() + { + err.span_suggestion_verbose( + rhs_span.shrink_to_hi(), + "consider using a floating-point literal by writing it with `.0`", + ".0", + Applicability::MaybeIncorrect, + ); } } diff --git a/src/test/ui/traits/issue-102989.rs b/src/test/ui/traits/issue-102989.rs new file mode 100644 index 0000000000000..cd517a1c4ac87 --- /dev/null +++ b/src/test/ui/traits/issue-102989.rs @@ -0,0 +1,18 @@ +// compile-flags: -Cinstrument-coverage +//~^ ERROR can't find crate for `profiler_builtins` + +#![no_core] +#![feature(no_core, lang_items)] +#[lang="sized"] +trait Sized { } //~ ERROR found duplicate lang item `sized` + +fn ref_Struct(self: &Struct, f: &u32) -> &u32 { + //~^ ERROR `self` parameter is only allowed in associated functions + //~| ERROR cannot find type `Struct` in this scope + //~| ERROR mismatched types + let x = x << 1; + //~^ ERROR the size for values of type `{integer}` cannot be known at compilation time + //~| ERROR cannot find value `x` in this scope +} + +fn main() {} diff --git a/src/test/ui/traits/issue-102989.stderr b/src/test/ui/traits/issue-102989.stderr new file mode 100644 index 0000000000000..255fa6966efc9 --- /dev/null +++ b/src/test/ui/traits/issue-102989.stderr @@ -0,0 +1,72 @@ +error: `self` parameter is only allowed in associated functions + --> $DIR/issue-102989.rs:9:15 + | +LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 { + | ^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error[E0412]: cannot find type `Struct` in this scope + --> $DIR/issue-102989.rs:9:22 + | +LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 { + | ^^^^^^ not found in this scope + +error[E0425]: cannot find value `x` in this scope + --> $DIR/issue-102989.rs:13:13 + | +LL | let x = x << 1; + | ^ help: a local variable with a similar name exists: `f` + +error: `profiler_builtins` crate (required by compiler options) is not compatible with crate attribute `#![no_core]` + +error[E0463]: can't find crate for `profiler_builtins` + | + = note: the compiler may have been built without the profiler runtime + +error[E0152]: found duplicate lang item `sized` + --> $DIR/issue-102989.rs:7:1 + | +LL | trait Sized { } + | ^^^^^^^^^^^ + | + = note: the lang item is first defined in crate `core`. + = note: first definition in `core` loaded from $BUILD_DIR/aarch64-apple-darwin/stage1/lib/rustlib/aarch64-apple-darwin/lib/libcore-500f4c12402b1108.rlib + = note: second definition in the local crate (`issue_102989`) + +error: `#[panic_handler]` function required, but not found + +error: language item required, but not found: `eh_personality` + | + = note: this can occur when a binary crate with `#![no_std]` is compiled for a target where `eh_personality` is defined in the standard library + = help: you may be able to compile for a target that doesn't need `eh_personality`, specify a target with `--target` or in `.cargo/config` + +error[E0277]: the size for values of type `{integer}` cannot be known at compilation time + --> $DIR/issue-102989.rs:13:15 + | +LL | let x = x << 1; + | ^^ doesn't have a size known at compile-time + | + = help: the trait `core::marker::Sized` is not implemented for `{integer}` + +error[E0308]: mismatched types + --> $DIR/issue-102989.rs:9:42 + | +LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 { + | ---------- ^^^^ expected `&u32`, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression + | +note: consider returning one of these bindings + --> $DIR/issue-102989.rs:9:30 + | +LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 { + | ^ +... +LL | let x = x << 1; + | ^ + +error: aborting due to 10 previous errors + +Some errors have detailed explanations: E0152, E0277, E0308, E0412, E0425, E0463. +For more information about an error, try `rustc --explain E0152`. From 5378677c31e89ae2fe4de954631bde8efeac91d1 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Thu, 13 Oct 2022 15:07:39 +0900 Subject: [PATCH 05/10] normalize stderr --- src/test/ui/traits/issue-102989.rs | 3 ++- src/test/ui/traits/issue-102989.stderr | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/test/ui/traits/issue-102989.rs b/src/test/ui/traits/issue-102989.rs index cd517a1c4ac87..cb1e3271d26e8 100644 --- a/src/test/ui/traits/issue-102989.rs +++ b/src/test/ui/traits/issue-102989.rs @@ -1,5 +1,6 @@ +//~ ERROR can't find crate for `profiler_builtins` // compile-flags: -Cinstrument-coverage -//~^ ERROR can't find crate for `profiler_builtins` +// normalize-stderr-test "loaded from .*libcore-.*.rlib" -> "loaded from SYSROOT/libcore-*.rlib" #![no_core] #![feature(no_core, lang_items)] diff --git a/src/test/ui/traits/issue-102989.stderr b/src/test/ui/traits/issue-102989.stderr index 255fa6966efc9..efea2251a13f8 100644 --- a/src/test/ui/traits/issue-102989.stderr +++ b/src/test/ui/traits/issue-102989.stderr @@ -1,5 +1,5 @@ error: `self` parameter is only allowed in associated functions - --> $DIR/issue-102989.rs:9:15 + --> $DIR/issue-102989.rs:10:15 | LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 { | ^^^^ not semantically valid as function parameter @@ -7,13 +7,13 @@ LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 { = note: associated functions are those in `impl` or `trait` definitions error[E0412]: cannot find type `Struct` in this scope - --> $DIR/issue-102989.rs:9:22 + --> $DIR/issue-102989.rs:10:22 | LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 { | ^^^^^^ not found in this scope error[E0425]: cannot find value `x` in this scope - --> $DIR/issue-102989.rs:13:13 + --> $DIR/issue-102989.rs:14:13 | LL | let x = x << 1; | ^ help: a local variable with a similar name exists: `f` @@ -25,13 +25,13 @@ error[E0463]: can't find crate for `profiler_builtins` = note: the compiler may have been built without the profiler runtime error[E0152]: found duplicate lang item `sized` - --> $DIR/issue-102989.rs:7:1 + --> $DIR/issue-102989.rs:8:1 | LL | trait Sized { } | ^^^^^^^^^^^ | = note: the lang item is first defined in crate `core`. - = note: first definition in `core` loaded from $BUILD_DIR/aarch64-apple-darwin/stage1/lib/rustlib/aarch64-apple-darwin/lib/libcore-500f4c12402b1108.rlib + = note: first definition in `core` loaded from SYSROOT/libcore-*.rlib = note: second definition in the local crate (`issue_102989`) error: `#[panic_handler]` function required, but not found @@ -42,7 +42,7 @@ error: language item required, but not found: `eh_personality` = help: you may be able to compile for a target that doesn't need `eh_personality`, specify a target with `--target` or in `.cargo/config` error[E0277]: the size for values of type `{integer}` cannot be known at compilation time - --> $DIR/issue-102989.rs:13:15 + --> $DIR/issue-102989.rs:14:15 | LL | let x = x << 1; | ^^ doesn't have a size known at compile-time @@ -50,7 +50,7 @@ LL | let x = x << 1; = help: the trait `core::marker::Sized` is not implemented for `{integer}` error[E0308]: mismatched types - --> $DIR/issue-102989.rs:9:42 + --> $DIR/issue-102989.rs:10:42 | LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 { | ---------- ^^^^ expected `&u32`, found `()` @@ -58,7 +58,7 @@ LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 { | implicitly returns `()` as its body has no tail or `return` expression | note: consider returning one of these bindings - --> $DIR/issue-102989.rs:9:30 + --> $DIR/issue-102989.rs:10:30 | LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 { | ^ From dbb4271bb495bf3ac290b910a7ce1c48d73ad01c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 14 Oct 2022 08:40:55 +0200 Subject: [PATCH 06/10] checktools: fix comments --- src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh b/src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh index cf00c285b0a63..3e1f39eaab5a4 100755 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh @@ -4,7 +4,7 @@ set -eu X_PY="$1" -# Try to test all the tools and store the build/test success in the TOOLSTATE_FILE +# Try to test the toolstate-tracked tools and store the build/test success in the TOOLSTATE_FILE. set +e python3 "$X_PY" test --stage 2 --no-fail-fast \ @@ -19,6 +19,8 @@ set -e # debugging: print out the saved toolstates cat /tmp/toolstate/toolstates.json + +# Test remaining tools that must pass. python3 "$X_PY" test --stage 2 check-tools python3 "$X_PY" test --stage 2 src/tools/clippy python3 "$X_PY" test --stage 2 src/tools/rustfmt From b8bb40664cc454c6f09235465a2e4faf66f160cc Mon Sep 17 00:00:00 2001 From: Lukas Markeffsky <@> Date: Fri, 14 Oct 2022 12:14:29 +0200 Subject: [PATCH 07/10] remove leading newlines from integer primitive doc examples --- library/core/src/num/int_macros.rs | 9 --------- library/core/src/num/uint_macros.rs | 2 -- 2 files changed, 11 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index ff3b7bc2c9047..b413a85fee340 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -652,7 +652,6 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_rem(2), Some(1));")] #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_rem(0), None);")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_rem(-1), None);")] @@ -704,7 +703,6 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_neg(), Some(-5));")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_neg(), None);")] /// ``` @@ -820,7 +818,6 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #[doc = concat!("assert_eq!((-5", stringify!($SelfT), ").checked_abs(), Some(5));")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_abs(), None);")] /// ``` @@ -1026,7 +1023,6 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #[doc = concat!("assert_eq!(10", stringify!($SelfT), ".saturating_mul(12), 120);")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.saturating_mul(10), ", stringify!($SelfT), "::MAX);")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.saturating_mul(10), ", stringify!($SelfT), "::MIN);")] @@ -1085,7 +1081,6 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #[doc = concat!("assert_eq!((-4", stringify!($SelfT), ").saturating_pow(3), -64);")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.saturating_pow(2), ", stringify!($SelfT), "::MAX);")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.saturating_pow(3), ", stringify!($SelfT), "::MIN);")] @@ -1498,7 +1493,6 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_add(2), (7, false));")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (", stringify!($SelfT), "::MIN, true));")] /// ``` @@ -1593,7 +1587,6 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_sub(2), (3, false));")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.overflowing_sub(1), (", stringify!($SelfT), "::MAX, true));")] /// ``` @@ -1703,7 +1696,6 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_div(2), (2, false));")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.overflowing_div(-1), (", stringify!($SelfT), "::MIN, true));")] /// ``` @@ -1766,7 +1758,6 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_rem(2), (1, false));")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.overflowing_rem(-1), (0, true));")] /// ``` diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index d921ff9ba1026..b177e5e390028 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1456,7 +1456,6 @@ macro_rules! uint_impl { /// Basic usage /// /// ``` - /// #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_add(2), (7, false));")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (0, true));")] /// ``` @@ -1551,7 +1550,6 @@ macro_rules! uint_impl { /// Basic usage /// /// ``` - /// #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_sub(2), (3, false));")] #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".overflowing_sub(1), (", stringify!($SelfT), "::MAX, true));")] /// ``` From 0313fbe5a942ed82b8216bab169a035bc4b639db Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 14 Oct 2022 12:43:42 +0200 Subject: [PATCH 08/10] Update browser-ui-test version to fix some flaky tests --- .../docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version index d61567cd134a3..7fd0b1e8e6ff6 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version @@ -1 +1 @@ -0.12.3 \ No newline at end of file +0.12.4 \ No newline at end of file From f95e8532222479c417fdf9fffc6ce1ab8cda3413 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Fri, 14 Oct 2022 12:17:07 +0100 Subject: [PATCH 09/10] Tweak grammar --- library/std/src/io/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/io/error.rs b/library/std/src/io/error.rs index 2bbfbe38a24ae..837145bfaede6 100644 --- a/library/std/src/io/error.rs +++ b/library/std/src/io/error.rs @@ -496,7 +496,7 @@ impl Error { /// // errors can also be created from other errors /// let custom_error2 = Error::new(ErrorKind::Interrupted, custom_error); /// - /// // creating an error without payload (also without memory allocation) + /// // creating an error without payload (and without memory allocation) /// let eof_error = Error::from(ErrorKind::UnexpectedEof); /// ``` #[stable(feature = "rust1", since = "1.0.0")] From 9787321841d604b792be107e91bcca8ee1ecfd52 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 14 Oct 2022 14:55:11 +0200 Subject: [PATCH 10/10] Clean up rust-logo rustdoc GUI test --- src/test/rustdoc-gui/rust-logo.goml | 96 ++++++++--------------------- 1 file changed, 26 insertions(+), 70 deletions(-) diff --git a/src/test/rustdoc-gui/rust-logo.goml b/src/test/rustdoc-gui/rust-logo.goml index 80abdc50c14ff..6c8dc85941931 100644 --- a/src/test/rustdoc-gui/rust-logo.goml +++ b/src/test/rustdoc-gui/rust-logo.goml @@ -1,78 +1,34 @@ // This test ensures that the correct style is applied to the rust logo in the sidebar. goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -// First we start with the dark theme. -local-storage: { - "rustdoc-theme": "dark", - "rustdoc-preferred-dark-theme": "dark", - "rustdoc-use-system-theme": "false", -} -reload: - -assert-css: ( - ".rust-logo", - {"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"}, +define-function: ( + "check-logo", + (theme, filter), + [ + // Going to the doc page. + ("goto", "file://" + |DOC_PATH| + "/test_docs/index.html"), + // Changing theme. + ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}), + ("reload"), + ("assert-css", (".rust-logo", {"filter": |filter|})), + // Going to the source code page. + ("goto", "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"), + // Changing theme (since it's local files, the local storage works by folder). + ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}), + ("reload"), + ("assert-css", (".rust-logo", {"filter": |filter|})), + ], ) -// In the source view page now. -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" - -local-storage: { - "rustdoc-theme": "dark", - "rustdoc-preferred-dark-theme": "dark", - "rustdoc-use-system-theme": "false", -} -reload: - -assert-css: ( - ".rust-logo", - {"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"}, +call-function: ( + "check-logo", + ("ayu", "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"), ) - -// Then with the ayu theme. -local-storage: { - "rustdoc-theme": "ayu", - "rustdoc-preferred-dark-theme": "ayu", - "rustdoc-use-system-theme": "false", -} -reload: - -assert-css: ( - ".rust-logo", - {"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"}, +call-function: ( + "check-logo", + ("dark", "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"), ) - -// In the source view page now. -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" - -local-storage: { - "rustdoc-theme": "ayu", - "rustdoc-preferred-dark-theme": "ayu", - "rustdoc-use-system-theme": "false", -} -reload: - -assert-css: ( - ".rust-logo", - {"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"}, -) - -// And finally with the light theme. -local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} -reload: - -assert-css: ( - ".rust-logo", - {"filter": "none"}, -) - -// In the source view page now. -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" - -local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} -reload: - -assert-css: ( - ".rust-logo", - {"filter": "none"}, +call-function: ( + "check-logo", + ("light", "none"), )