From 8aead9bf10e77f80fcad919174470036499bab64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 17 Dec 2025 17:06:52 +0100 Subject: [PATCH] chore: upgrade Rust to 1.92 (#31592) --- .github/workflows/ci.generate.ts | 4 +-- .github/workflows/ci.yml | 34 +++++++++---------- cli/cache/cache_db.rs | 2 +- cli/lsp/tsc.rs | 1 - cli/tools/coverage/util.rs | 6 ++-- cli/tools/pm/audit.rs | 4 +-- libs/npm_cache/remote.rs | 8 +++-- runtime/web_worker.rs | 10 +++--- runtime/worker.rs | 10 +++--- rust-toolchain.toml | 2 +- .../test/recursive_permissions_pledge/err.out | 2 +- 11 files changed, 44 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts index 64732d9b1a..1225995bf1 100755 --- a/.github/workflows/ci.generate.ts +++ b/.github/workflows/ci.generate.ts @@ -5,7 +5,7 @@ import { stringify } from "jsr:@std/yaml@^0.221/stringify"; // Bump this number when you want to purge the cache. // Note: the tools/release/01_bump_crate_versions.ts script will update this version // automatically via regex, so ensure that this line maintains this format. -const cacheVersion = 84; +const cacheVersion = 86; const ubuntuX86Runner = "ubuntu-24.04"; const ubuntuX86XlRunner = "ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04"; @@ -76,7 +76,7 @@ const prCachePath = [ ].join("\n"); // Note that you may need to add more version to the `apt-get remove` line below if you change this -const llvmVersion = 20; +const llvmVersion = 21; const installPkgsCommand = `sudo apt-get install -y --no-install-recommends clang-${llvmVersion} lld-${llvmVersion} clang-tools-${llvmVersion} clang-format-${llvmVersion} clang-tidy-${llvmVersion}`; const sysRootStep = { diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 398edd3646..52c19171eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -173,8 +173,8 @@ jobs: ~/.cargo/registry/index ~/.cargo/registry/cache ~/.cargo/git/db - key: '84-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}' - restore-keys: '84-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-' + key: '86-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}' + restore-keys: '86-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-' if: '!(matrix.skip)' - uses: dsherret/rust-toolchain-file@v1 if: '!(matrix.skip)' @@ -260,18 +260,18 @@ jobs: sudo apt-get -qq remove 'clang-12*' 'clang-13*' 'clang-14*' 'clang-15*' 'clang-16*' 'clang-17*' 'clang-18*' 'clang-19*' 'llvm-12*' 'llvm-13*' 'llvm-14*' 'llvm-15*' 'llvm-16*' 'llvm-17*' 'llvm-18*' 'llvm-19*' 'lld-12*' 'lld-13*' 'lld-14*' 'lld-15*' 'lld-16*' 'lld-17*' 'lld-18*' 'lld-19*' > /dev/null 2> /dev/null # Install clang-XXX, lld-XXX, and debootstrap. - echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" | - sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-jammy-20.list + echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-21 main" | + sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-jammy-21.list curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg sudo apt-get update # this was unreliable sometimes, so try again if it fails - sudo apt-get install -y --no-install-recommends clang-20 lld-20 clang-tools-20 clang-format-20 clang-tidy-20 || echo 'Failed. Trying again.' && sudo apt-get clean && sudo apt-get update && sudo apt-get install -y --no-install-recommends clang-20 lld-20 clang-tools-20 clang-format-20 clang-tidy-20 + sudo apt-get install -y --no-install-recommends clang-21 lld-21 clang-tools-21 clang-format-21 clang-tidy-21 || echo 'Failed. Trying again.' && sudo apt-get clean && sudo apt-get update && sudo apt-get install -y --no-install-recommends clang-21 lld-21 clang-tools-21 clang-format-21 clang-tidy-21 # Fix alternatives (yes '' | sudo update-alternatives --force --all) > /dev/null 2> /dev/null || true - clang-20 -c -o /tmp/memfd_create_shim.o tools/memfd_create_shim.c -fPIC + clang-21 -c -o /tmp/memfd_create_shim.o tools/memfd_create_shim.c -fPIC echo "Decompressing sysroot..." wget -q https://github.com/denoland/deno_sysroot_build/releases/download/sysroot-20250207/sysroot-`uname -m`.tar.xz -O /tmp/sysroot.tar.xz @@ -304,8 +304,8 @@ jobs: CARGO_PROFILE_RELEASE_INCREMENTAL=false RUSTFLAGS<<__1 -C linker-plugin-lto=true - -C linker=clang-20 - -C link-arg=-fuse-ld=lld-20 + -C linker=clang-21 + -C link-arg=-fuse-ld=lld-21 -C link-arg=-ldl -C link-arg=-Wl,--allow-shlib-undefined -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache @@ -316,8 +316,8 @@ jobs: __1 RUSTDOCFLAGS<<__1 -C linker-plugin-lto=true - -C linker=clang-20 - -C link-arg=-fuse-ld=lld-20 + -C linker=clang-21 + -C link-arg=-fuse-ld=lld-21 -C link-arg=-ldl -C link-arg=-Wl,--allow-shlib-undefined -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache @@ -326,7 +326,7 @@ jobs: --cfg tokio_unstable $RUSTFLAGS __1 - CC=/usr/bin/clang-20 + CC=/usr/bin/clang-21 CFLAGS=$CFLAGS " > $GITHUB_ENV - name: Remove macOS cURL --ipv4 flag @@ -379,7 +379,7 @@ jobs: !./target/*/*.zip !./target/*/*.tar.gz key: never_saved - restore-keys: '84-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-' + restore-keys: '86-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-' - name: Apply and update mtime cache if: '!(matrix.skip) && (!startsWith(github.ref, ''refs/tags/''))' uses: ./.github/mtime_cache @@ -744,7 +744,7 @@ jobs: !./target/*/gn_root !./target/*/*.zip !./target/*/*.tar.gz - key: '84-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}' + key: '86-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}' lint: name: 'lint ${{ matrix.profile }} ${{ matrix.os }}-${{ matrix.arch }}' needs: @@ -795,8 +795,8 @@ jobs: ~/.cargo/registry/index ~/.cargo/registry/cache ~/.cargo/git/db - key: '84-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}' - restore-keys: '84-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-' + key: '86-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}' + restore-keys: '86-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-' - uses: dsherret/rust-toolchain-file@v1 - name: Install Deno uses: denoland/setup-deno@v2 @@ -813,7 +813,7 @@ jobs: !./target/*/*.zip !./target/*/*.tar.gz key: never_saved - restore-keys: '84-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-' + restore-keys: '86-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-' - name: test_format.js if: matrix.os == 'linux' run: deno run --allow-write --allow-read --allow-run --allow-net ./tools/format.js --check @@ -833,7 +833,7 @@ jobs: !./target/*/gn_root !./target/*/*.zip !./target/*/*.tar.gz - key: '84-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}' + key: '86-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}' libs: name: build libs needs: diff --git a/cli/cache/cache_db.rs b/cli/cache/cache_db.rs index a1d4acf6ff..8e7221239d 100644 --- a/cli/cache/cache_db.rs +++ b/cli/cache/cache_db.rs @@ -605,7 +605,7 @@ mod tests { assert_same_serialize_deserialize(CacheDBHash::new(u64::MAX)); assert_same_serialize_deserialize(CacheDBHash::new(u64::MAX - 1)); assert_same_serialize_deserialize(CacheDBHash::new(u64::MIN)); - assert_same_serialize_deserialize(CacheDBHash::new(u64::MIN + 1)); + assert_same_serialize_deserialize(CacheDBHash::new(1)); } fn assert_same_serialize_deserialize(original_hash: CacheDBHash) { diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs index e509c40f11..ef643c03f6 100644 --- a/cli/lsp/tsc.rs +++ b/cli/lsp/tsc.rs @@ -52,7 +52,6 @@ use deno_runtime::tokio_util::create_basic_runtime; use indexmap::IndexMap; use indexmap::IndexSet; use lazy_regex::lazy_regex; -use log::error; use lsp_types::Uri; use node_resolver::NodeResolutionKind; use node_resolver::ResolutionMode; diff --git a/cli/tools/coverage/util.rs b/cli/tools/coverage/util.rs index e61830b7fe..c43335139a 100644 --- a/cli/tools/coverage/util.rs +++ b/cli/tools/coverage/util.rs @@ -54,7 +54,7 @@ mod tests { #[test] fn test_find_root() { - let urls = vec![ + let urls = [ Url::parse("file:///a/b/c/d/e.ts").unwrap(), Url::parse("file:///a/b/c/d/f.ts").unwrap(), Url::parse("file:///a/b/c/d/g.ts").unwrap(), @@ -71,7 +71,7 @@ mod tests { #[test] fn test_find_root_with_similar_filenames() { - let urls = vec![ + let urls = [ Url::parse("file:///a/b/c/d/foo0.ts").unwrap(), Url::parse("file:///a/b/c/d/foo1.ts").unwrap(), Url::parse("file:///a/b/c/d/foo2.ts").unwrap(), @@ -82,7 +82,7 @@ mod tests { #[test] fn test_find_root_with_similar_dirnames() { - let urls = vec![ + let urls = [ Url::parse("file:///a/b/c/foo0/mod.ts").unwrap(), Url::parse("file:///a/b/c/foo1/mod.ts").unwrap(), Url::parse("file:///a/b/c/foo2/mod.ts").unwrap(), diff --git a/cli/tools/pm/audit.rs b/cli/tools/pm/audit.rs index d3da714b2f..735d155782 100644 --- a/cli/tools/pm/audit.rs +++ b/cli/tools/pm/audit.rs @@ -504,9 +504,9 @@ mod npm { action.action, action.module, if let Some(target) = &action.target { - &format!("@{}", target) + format!("@{}", target) } else { - "" + "".to_string() }, if action.is_major { " (major upgrade)" diff --git a/libs/npm_cache/remote.rs b/libs/npm_cache/remote.rs index 56156a80ff..9131d36e0e 100644 --- a/libs/npm_cache/remote.rs +++ b/libs/npm_cache/remote.rs @@ -36,16 +36,18 @@ pub fn maybe_auth_header_value_for_npm_registry( return Err(AuthHeaderForNpmRegistryError::Both); } - if username.is_some() && password.is_some() { + if let Some(username) = username + && let Some(password) = password + { // The npm client does some double encoding when generating the // bearer token value, see // https://github.com/npm/cli/blob/780afc50e3a345feb1871a28e33fa48235bc3bd5/workspaces/config/lib/index.js#L846-L851 let pw_base64 = BASE64_STANDARD - .decode(password.unwrap()) + .decode(password) .map_err(AuthHeaderForNpmRegistryError::Base64)?; let bearer = BASE64_STANDARD.encode(format!( "{}:{}", - username.unwrap(), + username, String::from_utf8_lossy(&pw_base64) )); diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index 9a56e14a7a..c1ab4e4bf5 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -602,10 +602,12 @@ impl WebWorker { ]; #[cfg(feature = "hmr")] - assert!( - cfg!(not(feature = "only_snapshotted_js_sources")), - "'hmr' is incompatible with 'only_snapshotted_js_sources'." - ); + const { + assert!( + cfg!(not(feature = "only_snapshotted_js_sources")), + "'hmr' is incompatible with 'only_snapshotted_js_sources'." + ); + } for extension in &mut extensions { if options.startup_snapshot.is_some() { diff --git a/runtime/worker.rs b/runtime/worker.rs index 1abea7eff5..1339d3fb31 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -444,10 +444,12 @@ impl MainWorker { } #[cfg(feature = "hmr")] - assert!( - cfg!(not(feature = "only_snapshotted_js_sources")), - "'hmr' is incompatible with 'only_snapshotted_js_sources'." - ); + const { + assert!( + cfg!(not(feature = "only_snapshotted_js_sources")), + "'hmr' is incompatible with 'only_snapshotted_js_sources'." + ); + } #[cfg(feature = "only_snapshotted_js_sources")] options.startup_snapshot.as_ref().expect("A user snapshot was not provided, even though 'only_snapshotted_js_sources' is used."); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 43e5784a18..1a21655815 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.90.0" +channel = "1.92.0" components = ["rustfmt", "clippy"] diff --git a/tests/specs/test/recursive_permissions_pledge/err.out b/tests/specs/test/recursive_permissions_pledge/err.out index a3f151ee02..912a3e631c 100644 --- a/tests/specs/test/recursive_permissions_pledge/err.out +++ b/tests/specs/test/recursive_permissions_pledge/err.out @@ -10,6 +10,6 @@ Platform: [WILDLINE] Version: [WILDLINE] Args: [[WILDLINE], "test", "main.js"] [WILDCARD] -thread 'tokio-runtime-worker' panicked at [WILDLINE] +thread 'tokio-runtime-worker' ([WILDCARD]) panicked at [WILDLINE] pledge test permissions called before restoring previous pledge note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace