diff --git a/RELEASES.md b/RELEASES.md index 1dd929b699573..615146eddc92a 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,45 +1,49 @@ -Version 1.93 (2026-01-22) +Version 1.93.1 (2026-02-12) +=========================== + + + +- [Don't try to recover keyword as non-keyword identifier](https://github.com/rust-lang/rust/pull/150590), fixing an ICE that especially [affected rustfmt](https://github.com/rust-lang/rustfmt/issues/6739). +- [Fix `clippy::panicking_unwrap` false-positive on field access with implicit deref](https://github.com/rust-lang/rust-clippy/pull/16196). +- [Revert "Update wasm-related dependencies in CI"](https://github.com/rust-lang/rust/pull/152259), fixing file descriptor leaks on the `wasm32-wasip2` target. + +Version 1.93.0 (2026-01-22) ========================== - + Language -------- -- [Add warn-by-default `function_casts_as_integer` lint](https://github.com/rust-lang/rust/pull/141470) -- [Add future-incompatibility warning for `...` function parameters without a pattern outside of `extern` blocks](https://github.com/rust-lang/rust/pull/143619) - [Stabilize several s390x `vector`-related target features and the `is_s390x_feature_detected!` macro](https://github.com/rust-lang/rust/pull/145656) - [Stabilize declaration of C-style variadic functions for the `system` ABI](https://github.com/rust-lang/rust/pull/145954) - [Emit error when using some keyword as a `cfg` predicate](https://github.com/rust-lang/rust/pull/146978) -- [Introduce future-compatibility warning for `repr(C)` enums whose discriminant values do not fit into a `c_int` or `c_uint`](https://github.com/rust-lang/rust/pull/147017) -- [Introduce future-compatibility warning against ignoring `repr(C)` types as part of `repr(transparent)`](https://github.com/rust-lang/rust/pull/147185) - [Stabilize `asm_cfg`](https://github.com/rust-lang/rust/pull/147736) -- [Upgrade the `deref_nullptr` lint from warn-by-default to deny-by-default](https://github.com/rust-lang/rust/pull/148122) - [During const-evaluation, support copying pointers byte-by-byte](https://github.com/rust-lang/rust/pull/148259) -- [Add warn-by-default `const_item_interior_mutations` lint to warn against calls which mutate interior mutable `const` items](https://github.com/rust-lang/rust/pull/148407) - [LUB coercions now correctly handle function item types, and functions with differing safeties](https://github.com/rust-lang/rust/pull/148602) - [Allow `const` items that contain mutable references to `static` (which is *very* unsafe, but not *always* UB)](https://github.com/rust-lang/rust/pull/148746) +- [Add warn-by-default `const_item_interior_mutations` lint to warn against calls which mutate interior mutable `const` items](https://github.com/rust-lang/rust/pull/148407) +- [Add warn-by-default `function_casts_as_integer` lint](https://github.com/rust-lang/rust/pull/141470) - + Compiler -------- - [Stabilize `-Cjump-tables=bool`](https://github.com/rust-lang/rust/pull/145974). The flag was previously called `-Zno-jump-tables`. -- [Promote `riscv64a23-unknown-linux-gnu` to Tier 2 (without host tools)](https://github.com/rust-lang/rust/pull/148435) - - + Platform Support ---------------- +- [Promote `riscv64a23-unknown-linux-gnu` to Tier 2 (without host tools)](https://github.com/rust-lang/rust/pull/148435) Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. [platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html - + Libraries --------- @@ -49,14 +53,14 @@ Libraries - [Don't require `T: RefUnwindSafe` for `vec::IntoIter: UnwindSafe`](https://github.com/rust-lang/rust/pull/145665) - + Stabilized APIs --------------- -- [`>::assume_init_drop`](https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.assume_init_drop) -- [`>::assume_init_ref`](https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.assume_init_ref) -- [`>::assume_init_mut`](https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.assume_init_mut) +- [`<[MaybeUninit]>::assume_init_drop`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.assume_init_drop) +- [`<[MaybeUninit]>::assume_init_ref`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.assume_init_ref) +- [`<[MaybeUninit]>::assume_init_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.assume_init_mut) - [`<[MaybeUninit]>::write_copy_of_slice`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.write_copy_of_slice) - [`<[MaybeUninit]>::write_clone_of_slice`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.write_clone_of_slice) - [`String::into_raw_parts`](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.into_raw_parts) @@ -67,9 +71,9 @@ Stabilized APIs - [`::unchecked_shl`](https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unchecked_shl) - [`::unchecked_shr`](https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unchecked_shr) - [`<[T]>::as_array`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_array) -- [`<[T]>::as_array_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_mut_array) +- [`<[T]>::as_mut_array`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_mut_array) - [`<*const [T]>::as_array`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_array) -- [`<*mut [T]>::as_array_mut`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_mut_array) +- [`<*mut [T]>::as_mut_array`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_mut_array) - [`VecDeque::pop_front_if`](https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.pop_front_if) - [`VecDeque::pop_back_if`](https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.pop_back_if) - [`Duration::from_nanos_u128`](https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.from_nanos_u128) @@ -79,7 +83,7 @@ Stabilized APIs - [`std::fmt::FromFn`](https://doc.rust-lang.org/stable/std/fmt/struct.FromFn.html) - + Cargo ----- @@ -87,7 +91,7 @@ Cargo - [In `cargo tree`, support long forms for `--format` variables](https://github.com/rust-lang/cargo/pull/16204/) - [Add `--workspace` to `cargo clean`](https://github.com/rust-lang/cargo/pull/16263/) - + Rustdoc ----- @@ -97,7 +101,7 @@ Rustdoc - [Validate usage of crate-level doc attributes](https://github.com/rust-lang/rust/pull/149197). This means if any of `html_favicon_url`, `html_logo_url`, `html_playground_url`, `issue_tracker_base_url`, or `html_no_source` either has a missing value, an unexpected value, or a value of the wrong type, rustdoc will emit the deny-by-default lint `rustdoc::invalid_doc_attributes`. - + Compatibility Notes ------------------- @@ -108,6 +112,10 @@ Compatibility Notes - Cargo now sets the `CARGO_CFG_DEBUG_ASSERTIONS` environment variable in more situations. This will cause crates depending on `static-init` versions 1.0.1 to 1.0.3 to fail compilation with "failed to resolve: use of unresolved module or unlinked crate `parking_lot`". See [the linked issue](https://github.com/rust-lang/rust/issues/150646#issuecomment-3718964342) for details. - [User written types in the `offset_of!` macro are now checked to be well formed.](https://github.com/rust-lang/rust/issues/150465/) - `cargo publish` no longer emits `.crate` files as a final artifact for user access when the `build.build-dir` config is unset +- [Upgrade the `deref_nullptr` lint from warn-by-default to deny-by-default](https://github.com/rust-lang/rust/pull/148122) +- [Add future-incompatibility warning for `...` function parameters without a pattern outside of `extern` blocks](https://github.com/rust-lang/rust/pull/143619) +- [Introduce future-compatibility warning for `repr(C)` enums whose discriminant values do not fit into a `c_int` or `c_uint`](https://github.com/rust-lang/rust/pull/147017) +- [Introduce future-compatibility warning against ignoring `repr(C)` types as part of `repr(transparent)`](https://github.com/rust-lang/rust/pull/147185) Version 1.92.0 (2025-12-11) 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) 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 \ 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()); + } + } + } +} diff --git a/src/version b/src/version index 95784efddbc41..d8ac93bea02e6 100644 --- a/src/version +++ b/src/version @@ -1 +1 @@ -1.93.0 +1.93.1 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} 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 `