From f691f9a0ec7c1724112f9d97e9e9fb6f6e10888f Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 2 Jan 2026 17:26:41 +0800 Subject: [PATCH 1/8] Add regression tests for keyword-in-identifier-position recovery ICE ... in macro invocations. Issue: . (cherry picked from commit 31531b3665bba1a98740de4b9264901302b7255d) --- .../kw-in-const-item-pos-recovery-149692.rs | 11 +++++++ ...w-in-const-item-pos-recovery-149692.stderr | 11 +++++++ .../macro/kw-in-item-pos-recovery-149692.rs | 19 ++++++++++++ .../kw-in-item-pos-recovery-149692.stderr | 29 +++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 tests/ui/parser/macro/kw-in-const-item-pos-recovery-149692.rs create mode 100644 tests/ui/parser/macro/kw-in-const-item-pos-recovery-149692.stderr create mode 100644 tests/ui/parser/macro/kw-in-item-pos-recovery-149692.rs create mode 100644 tests/ui/parser/macro/kw-in-item-pos-recovery-149692.stderr diff --git a/tests/ui/parser/macro/kw-in-const-item-pos-recovery-149692.rs b/tests/ui/parser/macro/kw-in-const-item-pos-recovery-149692.rs new file mode 100644 index 0000000000000..58bb62bc4bf86 --- /dev/null +++ b/tests/ui/parser/macro/kw-in-const-item-pos-recovery-149692.rs @@ -0,0 +1,11 @@ +//! More test coverage for ; this test is +//! specifically for `const` items. + +macro_rules! m { + (const $id:item()) => {} +} + +m!(const Self()); +//~^ ERROR expected one of `!` or `::`, found `(` + +fn main() {} diff --git a/tests/ui/parser/macro/kw-in-const-item-pos-recovery-149692.stderr b/tests/ui/parser/macro/kw-in-const-item-pos-recovery-149692.stderr new file mode 100644 index 0000000000000..f9b73109dbb49 --- /dev/null +++ b/tests/ui/parser/macro/kw-in-const-item-pos-recovery-149692.stderr @@ -0,0 +1,11 @@ +error: expected one of `!` or `::`, found `(` + --> $DIR/kw-in-const-item-pos-recovery-149692.rs:8:14 + | +LL | (const $id:item()) => {} + | -------- while parsing argument for this `item` macro fragment +... +LL | m!(const Self()); + | ^ expected one of `!` or `::` + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/macro/kw-in-item-pos-recovery-149692.rs b/tests/ui/parser/macro/kw-in-item-pos-recovery-149692.rs new file mode 100644 index 0000000000000..223864e332966 --- /dev/null +++ b/tests/ui/parser/macro/kw-in-item-pos-recovery-149692.rs @@ -0,0 +1,19 @@ +//! Regression test for a diagnostic ICE where we tried to recover a keyword as the identifier when +//! we are already trying to recover a missing keyword before item. +//! +//! See . + +macro_rules! m { + ($id:item()) => {} +} + +m!(Self()); +//~^ ERROR expected one of `!` or `::`, found `(` + +m!(Self{}); +//~^ ERROR expected one of `!` or `::`, found `{` + +m!(crate()); +//~^ ERROR expected one of `!` or `::`, found `(` + +fn main() {} diff --git a/tests/ui/parser/macro/kw-in-item-pos-recovery-149692.stderr b/tests/ui/parser/macro/kw-in-item-pos-recovery-149692.stderr new file mode 100644 index 0000000000000..a65214b0d1f93 --- /dev/null +++ b/tests/ui/parser/macro/kw-in-item-pos-recovery-149692.stderr @@ -0,0 +1,29 @@ +error: expected one of `!` or `::`, found `(` + --> $DIR/kw-in-item-pos-recovery-149692.rs:10:8 + | +LL | ($id:item()) => {} + | -------- while parsing argument for this `item` macro fragment +... +LL | m!(Self()); + | ^ expected one of `!` or `::` + +error: expected one of `!` or `::`, found `{` + --> $DIR/kw-in-item-pos-recovery-149692.rs:13:8 + | +LL | ($id:item()) => {} + | -------- while parsing argument for this `item` macro fragment +... +LL | m!(Self{}); + | ^ expected one of `!` or `::` + +error: expected one of `!` or `::`, found `(` + --> $DIR/kw-in-item-pos-recovery-149692.rs:16:9 + | +LL | ($id:item()) => {} + | -------- while parsing argument for this `item` macro fragment +... +LL | m!(crate()); + | ^ expected one of `!` or `::` + +error: aborting due to 3 previous errors + From feb759bb79a51b3abef735a164346dcec3866d99 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 2 Jan 2026 17:27:35 +0800 Subject: [PATCH 2/8] Don't try to recover keyword as non-keyword identifier There's no sensible recovery scheme here, giving up the recovery is the right thing to do. (cherry picked from commit 79c47278f1ec8198cb8c0ed53eda46fc43b16a0d) --- compiler/rustc_parse/src/parser/item.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index abc0ffa87d3d0..5e725fd905627 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -393,6 +393,7 @@ impl<'a> Parser<'a> { let insert_span = ident_span.shrink_to_lo(); let ident = if self.token.is_ident() + && self.token.is_non_reserved_ident() && (!is_const || self.look_ahead(1, |t| *t == token::OpenParen)) && self.look_ahead(1, |t| { matches!(t.kind, token::Lt | token::OpenBrace | token::OpenParen) From 9c13ace16dce9c54222f5a8f02b4227e85edff21 Mon Sep 17 00:00:00 2001 From: Linshu Yang Date: Fri, 5 Dec 2025 18:18:58 +0000 Subject: [PATCH 3/8] fix: `panicking_unwrap` FP on field access with implicit deref (cherry picked from commit c9055034744c98739e087a2a7f3197f4e547aed2) --- src/tools/clippy/clippy_lints/src/unwrap.rs | 9 +++++++-- .../ui/checked_unwrap/simple_conditionals.rs | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/tools/clippy/clippy_lints/src/unwrap.rs b/src/tools/clippy/clippy_lints/src/unwrap.rs index 8ed3df8731b3f..a95f2b681add0 100644 --- a/src/tools/clippy/clippy_lints/src/unwrap.rs +++ b/src/tools/clippy/clippy_lints/src/unwrap.rs @@ -180,14 +180,19 @@ impl Local { field_indices, .. } => { + let field_projections = place + .projections + .iter() + .filter(|proj| matches!(proj.kind, ProjectionKind::Field(_, _))) + .collect::>(); is_potentially_local_place(*local_id, place) // If there were projections other than field projections, err on the side of caution and say that they // _might_ be mutating something. // // The reason we use `<=` and not `==` is that a mutation of `struct` or `struct.field1` should count as // mutation of the child fields such as `struct.field1.field2` - && place.projections.len() <= field_indices.len() - && iter::zip(&place.projections, field_indices.iter().copied().rev()).all(|(proj, field_idx)| { + && field_projections.len() <= field_indices.len() + && iter::zip(&field_projections, field_indices.iter().copied().rev()).all(|(proj, field_idx)| { match proj.kind { ProjectionKind::Field(f_idx, _) => f_idx == field_idx, // If this is a projection we don't expect, it _might_ be mutating something diff --git a/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.rs b/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.rs index c6476a7507a1d..bab20b091d389 100644 --- a/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.rs +++ b/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.rs @@ -472,3 +472,22 @@ fn issue15321() { //~^ unnecessary_unwrap } } + +mod issue16188 { + struct Foo { + value: Option, + } + + impl Foo { + pub fn bar(&mut self) { + let print_value = |v: i32| { + println!("{}", v); + }; + + if self.value.is_none() { + self.value = Some(10); + print_value(self.value.unwrap()); + } + } + } +} From f8cf317da396d8cf403171ba2713c07c301d1e39 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 6 Feb 2026 14:42:15 -0800 Subject: [PATCH 4/8] Revert "Update wasm-related dependencies in CI" This reverts commit 4c6e41cb5305567ddc81fde28b2f6e601c4936a4. --- src/ci/docker/host-x86_64/dist-various-2/Dockerfile | 4 ++-- src/ci/docker/host-x86_64/pr-check-2/Dockerfile | 4 ++-- src/ci/docker/host-x86_64/test-various/Dockerfile | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile index 90f46b5376e01..33d5512393621 100644 --- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile @@ -85,9 +85,9 @@ RUN /tmp/build-fuchsia-toolchain.sh COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/ RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh -RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-29/wasi-sdk-29.0-x86_64-linux.tar.gz | \ +RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-27/wasi-sdk-27.0-x86_64-linux.tar.gz | \ tar -xz -ENV WASI_SDK_PATH=/tmp/wasi-sdk-29.0-x86_64-linux +ENV WASI_SDK_PATH=/tmp/wasi-sdk-27.0-x86_64-linux COPY scripts/freebsd-toolchain.sh /tmp/ RUN /tmp/freebsd-toolchain.sh i686 diff --git a/src/ci/docker/host-x86_64/pr-check-2/Dockerfile b/src/ci/docker/host-x86_64/pr-check-2/Dockerfile index 68162d136c3f4..c9c3e3d2a3306 100644 --- a/src/ci/docker/host-x86_64/pr-check-2/Dockerfile +++ b/src/ci/docker/host-x86_64/pr-check-2/Dockerfile @@ -21,9 +21,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ mingw-w64 \ && rm -rf /var/lib/apt/lists/* -RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-29/wasi-sdk-29.0-x86_64-linux.tar.gz | \ +RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-27/wasi-sdk-27.0-x86_64-linux.tar.gz | \ tar -xz -ENV WASI_SDK_PATH=/wasi-sdk-29.0-x86_64-linux +ENV WASI_SDK_PATH=/wasi-sdk-27.0-x86_64-linux ENV RUST_CONFIGURE_ARGS="--set rust.validate-mir-opts=3" diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile index 9b1bf6c0df99d..e1c882d5b0850 100644 --- a/src/ci/docker/host-x86_64/test-various/Dockerfile +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile @@ -41,9 +41,9 @@ WORKDIR / COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-29/wasi-sdk-29.0-x86_64-linux.tar.gz | \ +RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-27/wasi-sdk-27.0-x86_64-linux.tar.gz | \ tar -xz -ENV WASI_SDK_PATH=/wasi-sdk-29.0-x86_64-linux +ENV WASI_SDK_PATH=/wasi-sdk-27.0-x86_64-linux ENV RUST_CONFIGURE_ARGS \ --musl-root-x86_64=/usr/local/x86_64-linux-musl \ @@ -56,9 +56,9 @@ ENV RUST_CONFIGURE_ARGS \ ENV NO_DEBUG_ASSERTIONS=1 ENV NO_OVERFLOW_CHECKS=1 -RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v38.0.4/wasmtime-v38.0.4-x86_64-linux.tar.xz | \ +RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.0/wasmtime-v19.0.0-x86_64-linux.tar.xz | \ tar -xJ -ENV PATH "$PATH:/wasmtime-v38.0.4-x86_64-linux" +ENV PATH "$PATH:/wasmtime-v19.0.0-x86_64-linux" ENV WASM_WASIP_TARGET=wasm32-wasip1 ENV WASM_WASIP_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_WASIP_TARGET \ From 128b1c9f64f85958246b7dfdafc6f62f17dc7bb9 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 4 Feb 2026 17:09:57 +0100 Subject: [PATCH 5/8] Remove rustdoc GUI flaky test (cherry picked from commit 607ac4bb840bc4b533b0758755a41b22a17d36b9) --- tests/rustdoc-gui/globals.goml | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 tests/rustdoc-gui/globals.goml diff --git a/tests/rustdoc-gui/globals.goml b/tests/rustdoc-gui/globals.goml deleted file mode 100644 index 89f57add81618..0000000000000 --- a/tests/rustdoc-gui/globals.goml +++ /dev/null @@ -1,20 +0,0 @@ -// Make sure search stores its data in `window` -// It needs to use a global to avoid racing on search-index.js and search.js -// https://github.com/rust-lang/rust/pull/118961 -include: "utils.goml" - -// URL query -go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=sa'%3Bda'%3Bds" -wait-for: "#search-tabs" -assert-window-property-false: {"searchIndex": null} - -// Form input -go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -call-function: ("perform-search", {"query": "Foo"}) -assert-window-property-false: {"searchIndex": null} - -// source sidebar -go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" -click: "#sidebar-button" -wait-for: "#src-sidebar details" -assert-window-property: {"searchIndex": null} From b8cc170b70ff51f55b72b4a668d7329ecebf659e Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Fri, 6 Feb 2026 01:13:41 +0100 Subject: [PATCH 6/8] Remove the 4 failing tests from rustdoc-gui (cherry picked from commit bce8c00e2f6bbd0d68a42fc7ee09b9eae6303f33) --- tests/rustdoc-gui/headers-color.goml | 71 ----- tests/rustdoc-gui/notable-trait.goml | 257 ------------------- tests/rustdoc-gui/search-filter.goml | 88 ------- tests/rustdoc-gui/search-result-display.goml | 114 -------- 4 files changed, 530 deletions(-) delete mode 100644 tests/rustdoc-gui/headers-color.goml delete mode 100644 tests/rustdoc-gui/notable-trait.goml delete mode 100644 tests/rustdoc-gui/search-filter.goml delete mode 100644 tests/rustdoc-gui/search-result-display.goml diff --git a/tests/rustdoc-gui/headers-color.goml b/tests/rustdoc-gui/headers-color.goml deleted file mode 100644 index 81346fc12d06d..0000000000000 --- a/tests/rustdoc-gui/headers-color.goml +++ /dev/null @@ -1,71 +0,0 @@ -// This test check for headings text and background colors for the different themes. - -include: "utils.goml" - -define-function: ( - "check-colors", - [theme, color, code_header_color, focus_background_color, headings_color], - block { - go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" - // This is needed so that the text color is computed. - show-text: true - call-function: ("switch-theme", {"theme": |theme|}) - assert-css: ( - ".impl", - {"color": |color|, "background-color": "rgba(0, 0, 0, 0)"}, - ALL, - ) - assert-css: ( - ".impl .code-header", - {"color": |code_header_color|, "background-color": "rgba(0, 0, 0, 0)"}, - ALL, - ) - go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo" - assert-css: ( - "#impl-Foo", - {"color": |color|, "background-color": |focus_background_color|}, - ) - go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use" - assert-css: ( - "#method\.must_use", - {"color": |color|, "background-color": |focus_background_color|}, - ALL, - ) - go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" - assert-css: (".section-header a", {"color": |color|}, ALL) - go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" - // We select headings (h2, h3, h...). - assert-css: (".docblock > :not(p) > a", {"color": |headings_color|}, ALL) - }, -) - -call-function: ( - "check-colors", - { - "theme": "ayu", - "color": "#c5c5c5", - "code_header_color": "#e6e1cf", - "focus_background_color": "rgba(255, 236, 164, 0.06)", - "headings_color": "#c5c5c5", - }, -) -call-function: ( - "check-colors", - { - "theme": "dark", - "color": "#ddd", - "code_header_color": "#ddd", - "focus_background_color": "#494a3d", - "headings_color": "#ddd", - }, -) -call-function: ( - "check-colors", - { - "theme": "light", - "color": "black", - "code_header_color": "black", - "focus_background_color": "#fdffd3", - "headings_color": "black", - }, -) diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml deleted file mode 100644 index 6bd4661ac8f46..0000000000000 --- a/tests/rustdoc-gui/notable-trait.goml +++ /dev/null @@ -1,257 +0,0 @@ -// This test checks the position of the `i` for the notable traits. -include: "utils.goml" -go-to: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html" -show-text: true - -define-function: ( - "check-notable-tooltip-position", - [x, i_x], - block { - // Checking they have the same y position. - compare-elements-position-near: ( - "//*[@id='method.create_an_iterator_from_read']//a[normalize-space()='NotableStructWithLongName']", - "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - {"y": 1}, - ) - // Checking they don't have the same x position. - compare-elements-position-false: ( - "//*[@id='method.create_an_iterator_from_read']//a[normalize-space()='NotableStructWithLongName']", - "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - ["x"], - ) - // The `i` should be *after* the type. - assert-position: ( - "//*[@id='method.create_an_iterator_from_read']//a[normalize-space()='NotableStructWithLongName']", - {"x": |x|}, - ) - assert-position: ( - "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - {"x": |i_x|}, - ) - }, -) - -define-function: ( - "check-notable-tooltip-position-complete", - [x, i_x, popover_x], - block { - call-function: ("check-notable-tooltip-position", {"x": |x|, "i_x": |i_x|}) - assert-count: ("//*[@class='tooltip popover']", 0) - click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" - assert-count: ("//*[@class='tooltip popover']", 1) - compare-elements-position-near: ( - "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - "//*[@class='tooltip popover']", - {"y": 30} - ) - compare-elements-position-false: ( - "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - "//*[@class='tooltip popover']", - ["x"] - ) - assert-position: ( - "//*[@class='tooltip popover']", - {"x": |popover_x|} - ) - click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" - move-cursor-to: "//h1" - assert-count: ("//*[@class='tooltip popover']", 0) - }, -) - -// We start with a wide screen. -set-window-size: (1100, 600) -call-function: ("check-notable-tooltip-position-complete", { - "x": 682, - "i_x": 960, - "popover_x": 468, -}) - -// Now only the `i` should be on the next line. -set-window-size: (1055, 600) -compare-elements-position-false: ( - "//*[@id='method.create_an_iterator_from_read']//a[normalize-space()='NotableStructWithLongName']", - "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - ["y", "x"], -) - -// Now both the `i` and the struct name should be on the next line. -set-window-size: (980, 600) -call-function: ("check-notable-tooltip-position", { - "x": 250, - "i_x": 528, -}) - -// Now check the colors. -define-function: ( - "check-colors", - [theme, header_color, content_color, type_color, trait_color, link_color], - block { - go-to: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html" - // This is needed to ensure that the text color is computed. - show-text: true - - call-function: ("switch-theme", {"theme": |theme|}) - - assert-css: ( - "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - {"color": |content_color|}, - ALL, - ) - - move-cursor-to: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" - wait-for-count: (".tooltip.popover", 1) - - assert-css: ( - "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - {"color": |link_color|}, - ALL, - ) - - assert-css: ( - ".tooltip.popover h3", - {"color": |header_color|}, - ALL, - ) - assert-css: ( - ".tooltip.popover pre", - {"color": |content_color|}, - ALL, - ) - assert-css: ( - ".tooltip.popover pre a.struct", - {"color": |type_color|}, - ALL, - ) - assert-css: ( - ".tooltip.popover pre a.trait", - {"color": |trait_color|}, - ALL, - ) - }, -) - -call-function: ( - "check-colors", - { - "theme": "ayu", - "link_color": "#39afd7", - "content_color": "#e6e1cf", - "header_color": "#fff", - "type_color": "#ffa0a5", - "trait_color": "#39afd7", - }, -) - -call-function: ( - "check-colors", - { - "theme": "dark", - "link_color": "#d2991d", - "content_color": "#ddd", - "header_color": "#ddd", - "type_color": "#2dbfb8", - "trait_color": "#b78cf2", - }, -) - -call-function: ( - "check-colors", - { - "theme": "light", - "link_color": "#3873ad", - "content_color": "black", - "header_color": "black", - "type_color": "#ad378a", - "trait_color": "#6e4fc9", - }, -) - -// Checking on mobile now. -set-window-size: (650, 600) -wait-for-size: ("body", {"width": 650}) -call-function: ("check-notable-tooltip-position-complete", { - "x": 26, - "i_x": 305, - "popover_x": 0, -}) - -reload: - -// Check that pressing escape works -click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" -move-cursor-to: "//*[@class='tooltip popover']" -assert-count: ("//*[@class='tooltip popover']", 1) -press-key: "Escape" -assert-count: ("//*[@class='tooltip popover']", 0) -assert: "#method\.create_an_iterator_from_read .tooltip:focus" - -// Check that clicking outside works. -click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" -assert-count: ("//*[@class='tooltip popover']", 1) -click: ".main-heading h1" -assert-count: ("//*[@class='tooltip popover']", 0) -assert-false: "#method\.create_an_iterator_from_read .tooltip:focus" - -// Check that pressing tab over and over works. -click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" -move-cursor-to: "//*[@class='tooltip popover']" -assert-count: ("//*[@class='tooltip popover']", 1) -press-key: "Tab" -press-key: "Tab" -press-key: "Tab" -press-key: "Tab" -press-key: "Tab" -press-key: "Tab" -press-key: "Tab" -assert-count: ("//*[@class='tooltip popover']", 0) -assert: "#method\.create_an_iterator_from_read .tooltip:focus" - -define-function: ( - "setup-popup", - [], - block { - store-window-property: {"scrollY": scroll} - click: "#method\.create_an_iterator_from_read .fn" - // We ensure that the scroll position changed. - assert-window-property-false: {"scrollY": |scroll|} - // Store the new position. - store-window-property: {"scrollY": scroll} - click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" - wait-for: "//*[@class='tooltip popover']" - click: ".main-heading h1" - } -) - -// Now we check that the focus isn't given back to the wrong item when opening -// another popover. -call-function: ("setup-popup", {}) -click: ".main-heading h1" -// We ensure we didn't come back to the previous focused item. -assert-window-property-false: {"scrollY": |scroll|} - -// Same but with Escape handling. -call-function: ("setup-popup", {}) -press-key: "Escape" -// We ensure we didn't come back to the previous focused item. -assert-window-property-false: {"scrollY": |scroll|} - -// Opening the mobile sidebar should close the popover. -set-window-size: (650, 600) -click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" -assert-count: ("//*[@class='tooltip popover']", 1) -click: ".sidebar-menu-toggle" -assert: "//*[@class='sidebar shown']" -assert-count: ("//*[@class='tooltip popover']", 0) -assert-false: "#method\.create_an_iterator_from_read .tooltip:focus" - -// Also check the focus handling for the settings button. -set-window-size: (1100, 600) -reload: -assert-count: ("//*[@class='tooltip popover']", 0) -click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" -assert-count: ("//*[@class='tooltip popover']", 1) -click: "rustdoc-toolbar .settings-menu a" -wait-for: "#settings" -assert-count: ("//*[@class='tooltip popover']", 0) -assert-false: "#method\.create_an_iterator_from_read .tooltip:focus" diff --git a/tests/rustdoc-gui/search-filter.goml b/tests/rustdoc-gui/search-filter.goml deleted file mode 100644 index d92d522c119d0..0000000000000 --- a/tests/rustdoc-gui/search-filter.goml +++ /dev/null @@ -1,88 +0,0 @@ -// Checks that the crate search filtering is handled correctly and changes the results. -include: "utils.goml" -go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -show-text: true -call-function: ("perform-search", {"query": "test"}) -assert-text: ("#results .externcrate", "test_docs") - -wait-for: "#crate-search" -// We now want to change the crate filter. -click: "#crate-search" -// We select "lib2" option then press enter to change the filter. -press-key: "ArrowDown" -press-key: "ArrowDown" -press-key: "ArrowDown" -press-key: "ArrowDown" -press-key: "ArrowDown" -press-key: "Enter" -// Waiting for the search results to appear... -wait-for: "#search-tabs" -wait-for-false: "#search-tabs .count.loading" -assert-document-property: ({"URL": "&filter-crate="}, CONTAINS) -// We check that there is no more "test_docs" appearing. -assert-false: "#results .externcrate" -// We also check that "lib2" is the filter crate. -assert-property: ("#crate-search", {"value": "lib2"}) - -// Now we check that leaving the search results and putting them back keeps the -// crate filtering. -press-key: "Escape" -wait-for-css: ("#main-content", {"display": "block"}) -click: "#search-button" -wait-for: ".search-input" -wait-for-css: ("#main-content", {"display": "none"}) -// We check that there is no more "test_docs" appearing. -assert-false: "#results .externcrate" -assert-property: ("#crate-search", {"value": "lib2"}) - -// Selecting back "All crates" -click: "#crate-search" -press-key: "ArrowUp" -press-key: "ArrowUp" -press-key: "ArrowUp" -press-key: "ArrowUp" -press-key: "ArrowUp" -press-key: "Enter" -// Waiting for the search results to appear... -wait-for: "#search-tabs" -wait-for-false: "#search-tabs .count.loading" -assert-property: ("#crate-search", {"value": "all crates"}) - -// Checking that the URL parameter is taken into account for crate filtering. -go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test&filter-crate=lib2" -wait-for: "#crate-search" -assert-property: ("#crate-search", {"value": "lib2"}) -assert-false: "#results .externcrate" - -// Checking that the text for the "title" is correct (the "all crates" comes from the "` is correctly handled when it goes to next line. -// To do so we need to update the length of one of its `