From 5c55f2b4fb9f386d5589e4cbd4c513ecb1bae50b Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 5 Jun 2023 20:35:39 -0400 Subject: [PATCH] chore: upgrade to Rust 1.70.0 (#19345) Co-authored-by: linbingquan <695601626@qq.com> --- .github/workflows/ci.generate.ts | 20 +++++++-------- .github/workflows/ci.yml | 24 +++++++++--------- Cargo.lock | 8 +++--- cli/lsp/capabilities.rs | 10 ++++---- cli/tools/upgrade.rs | 2 +- ext/ffi/Cargo.toml | 2 +- ext/net/lib.rs | 12 ++++----- ext/net/ops.rs | 42 +++++++++----------------------- ext/web/lib.rs | 2 +- runtime/permissions/mod.rs | 5 ++-- rust-toolchain.toml | 2 +- 11 files changed, 56 insertions(+), 73 deletions(-) diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts index cb32e6415d..59bada4fc4 100755 --- a/.github/workflows/ci.generate.ts +++ b/.github/workflows/ci.generate.ts @@ -5,7 +5,7 @@ import * as yaml from "https://deno.land/std@0.173.0/encoding/yaml.ts"; // 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 = 33; +const cacheVersion = 34; const Runners = (() => { const ubuntuRunner = "ubuntu-22.04"; @@ -24,16 +24,16 @@ const prCacheKeyPrefix = `${cacheVersion}-cargo-target-\${{ matrix.os }}-\${{ matrix.profile }}-\${{ matrix.job }}-`; const installPkgsCommand = - "sudo apt-get install --no-install-recommends debootstrap clang-15 lld-15"; + "sudo apt-get install --no-install-recommends debootstrap clang-16 lld-16"; const sysRootStep = { name: "Set up incremental LTO and sysroot build", run: `# Avoid running man-db triggers, which sometimes takes several minutes # to complete. sudo apt-get remove --purge -y man-db -# Install clang-15, lld-15, and debootstrap. -echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" | - sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-jammy-15.list +# Install clang-16, lld-16, and debootstrap. +echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | + sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-jammy-16.list curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg @@ -70,8 +70,8 @@ CARGO_PROFILE_RELEASE_INCREMENTAL=false CARGO_PROFILE_RELEASE_LTO=false RUSTFLAGS<<__1 -C linker-plugin-lto=true - -C linker=clang-15 - -C link-arg=-fuse-ld=lld-15 + -C linker=clang-16 + -C link-arg=-fuse-ld=lld-16 -C link-arg=--sysroot=/sysroot -C link-arg=-ldl -C link-arg=-Wl,--allow-shlib-undefined @@ -81,8 +81,8 @@ RUSTFLAGS<<__1 __1 RUSTDOCFLAGS<<__1 -C linker-plugin-lto=true - -C linker=clang-15 - -C link-arg=-fuse-ld=lld-15 + -C linker=clang-16 + -C link-arg=-fuse-ld=lld-16 -C link-arg=--sysroot=/sysroot -C link-arg=-ldl -C link-arg=-Wl,--allow-shlib-undefined @@ -90,7 +90,7 @@ RUSTDOCFLAGS<<__1 -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m \${{ env.RUSTFLAGS }} __1 -CC=clang-15 +CC=clang-16 CFLAGS=-flto=thin --sysroot=/sysroot __0`, }; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bb3ee964d..3ac0c2e243 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -210,15 +210,15 @@ jobs: # to complete. sudo apt-get remove --purge -y man-db - # Install clang-15, lld-15, and debootstrap. - echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" | - sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-jammy-15.list + # Install clang-16, lld-16, and debootstrap. + echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | + sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-jammy-16.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 --no-install-recommends debootstrap clang-15 lld-15 || echo 'Failed. Trying again.' && sudo apt-get clean && sudo apt-get update && sudo apt-get install --no-install-recommends debootstrap clang-15 lld-15 + sudo apt-get install --no-install-recommends debootstrap clang-16 lld-16 || echo 'Failed. Trying again.' && sudo apt-get clean && sudo apt-get update && sudo apt-get install --no-install-recommends debootstrap clang-16 lld-16 # Create ubuntu-16.04 sysroot environment, which is used to avoid # depending on a very recent version of glibc. @@ -249,8 +249,8 @@ jobs: CARGO_PROFILE_RELEASE_LTO=false RUSTFLAGS<<__1 -C linker-plugin-lto=true - -C linker=clang-15 - -C link-arg=-fuse-ld=lld-15 + -C linker=clang-16 + -C link-arg=-fuse-ld=lld-16 -C link-arg=--sysroot=/sysroot -C link-arg=-ldl -C link-arg=-Wl,--allow-shlib-undefined @@ -260,8 +260,8 @@ jobs: __1 RUSTDOCFLAGS<<__1 -C linker-plugin-lto=true - -C linker=clang-15 - -C link-arg=-fuse-ld=lld-15 + -C linker=clang-16 + -C link-arg=-fuse-ld=lld-16 -C link-arg=--sysroot=/sysroot -C link-arg=-ldl -C link-arg=-Wl,--allow-shlib-undefined @@ -269,7 +269,7 @@ jobs: -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m ${{ env.RUSTFLAGS }} __1 - CC=clang-15 + CC=clang-16 CFLAGS=-flto=thin --sysroot=/sysroot __0 - name: Log versions @@ -293,7 +293,7 @@ jobs: ~/.cargo/registry/index ~/.cargo/registry/cache ~/.cargo/git/db - key: '33-cargo-home-${{ matrix.os }}-${{ hashFiles(''Cargo.lock'') }}' + key: '34-cargo-home-${{ matrix.os }}-${{ hashFiles(''Cargo.lock'') }}' if: '!(github.event_name == ''pull_request'' && matrix.skip_pr)' - name: Restore cache build output (PR) uses: actions/cache/restore@v3 @@ -305,7 +305,7 @@ jobs: !./target/*/*.zip !./target/*/*.tar.gz key: never_saved - restore-keys: '33-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-' + restore-keys: '34-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-' - name: Apply and update mtime cache if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (!startsWith(github.ref, ''refs/tags/''))' uses: ./.github/mtime_cache @@ -589,7 +589,7 @@ jobs: !./target/*/gn_out !./target/*/*.zip !./target/*/*.tar.gz - key: '33-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}' + key: '34-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}' publish-canary: name: publish canary runs-on: ubuntu-22.04 diff --git a/Cargo.lock b/Cargo.lock index 4bab387ffc..f0721f433c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2787,9 +2787,9 @@ checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" [[package]] name = "libffi" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cb06d5b4c428f3cd682943741c39ed4157ae989fffe1094a08eaf7c4014cf60" +checksum = "ce826c243048e3d5cec441799724de52e2d42f820468431fc3fceee2341871e2" dependencies = [ "libc", "libffi-sys", @@ -2797,9 +2797,9 @@ dependencies = [ [[package]] name = "libffi-sys" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11c6f11e063a27ffe040a9d15f0b661bf41edc2383b7ae0e0ad5a7e7d53d9da3" +checksum = "f36115160c57e8529781b4183c2bb51fdc1f6d6d1ed345591d84be7703befb3c" dependencies = [ "cc", ] diff --git a/cli/lsp/capabilities.rs b/cli/lsp/capabilities.rs index e56aa6b873..355f7b6c51 100644 --- a/cli/lsp/capabilities.rs +++ b/cli/lsp/capabilities.rs @@ -1,10 +1,10 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -///! -///! Provides information about what capabilities that are supported by the -///! language server, which helps determine what messages are sent from the -///! client. -///! +//! +//! Provides information about what capabilities that are supported by the +//! language server, which helps determine what messages are sent from the +//! client. +//! use deno_core::serde_json::json; use tower_lsp::lsp_types::*; diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs index a6bc2975bb..b371731c31 100644 --- a/cli/tools/upgrade.rs +++ b/cli/tools/upgrade.rs @@ -334,7 +334,7 @@ pub async fn upgrade( }; let current_is_most_recent = if upgrade_flags.canary { - let latest_hash = latest_version.clone(); + let latest_hash = &latest_version; crate::version::GIT_COMMIT_HASH == latest_hash } else if !crate::version::is_canary() { let current = Version::parse_standard(crate::version::deno()).unwrap(); diff --git a/ext/ffi/Cargo.toml b/ext/ffi/Cargo.toml index 0173144775..ae62c20631 100644 --- a/ext/ffi/Cargo.toml +++ b/ext/ffi/Cargo.toml @@ -17,7 +17,7 @@ path = "lib.rs" deno_core.workspace = true dlopen.workspace = true dynasmrt = "1.2.3" -libffi = "3.1.0" +libffi = "3.2.0" serde.workspace = true serde-value = "0.7" serde_json = "1.0" diff --git a/ext/net/lib.rs b/ext/net/lib.rs index 912b0723ea..0e3778d5a8 100644 --- a/ext/net/lib.rs +++ b/ext/net/lib.rs @@ -98,12 +98,12 @@ deno_core::extension!(deno_net, ops::op_node_unstable_net_listen_udp

, ops::op_net_recv_udp, ops::op_net_send_udp

, - ops::op_net_join_multi_v4_udp

, - ops::op_net_join_multi_v6_udp

, - ops::op_net_leave_multi_v4_udp

, - ops::op_net_leave_multi_v6_udp

, - ops::op_net_set_multi_loopback_udp

, - ops::op_net_set_multi_ttl_udp

, + ops::op_net_join_multi_v4_udp, + ops::op_net_join_multi_v6_udp, + ops::op_net_leave_multi_v4_udp, + ops::op_net_leave_multi_v6_udp, + ops::op_net_set_multi_loopback_udp, + ops::op_net_set_multi_ttl_udp, ops::op_dns_resolve

, ops::op_set_nodelay, ops::op_set_keepalive, diff --git a/ext/net/ops.rs b/ext/net/ops.rs index 2264df8679..05aa416b4b 100644 --- a/ext/net/ops.rs +++ b/ext/net/ops.rs @@ -159,15 +159,12 @@ where } #[op] -async fn op_net_join_multi_v4_udp( +async fn op_net_join_multi_v4_udp( state: Rc>, rid: ResourceId, address: String, multi_interface: String, -) -> Result<(), AnyError> -where - NP: NetPermissions + 'static, -{ +) -> Result<(), AnyError> { let resource = state .borrow_mut() .resource_table @@ -184,15 +181,12 @@ where } #[op] -async fn op_net_join_multi_v6_udp( +async fn op_net_join_multi_v6_udp( state: Rc>, rid: ResourceId, address: String, multi_interface: u32, -) -> Result<(), AnyError> -where - NP: NetPermissions + 'static, -{ +) -> Result<(), AnyError> { let resource = state .borrow_mut() .resource_table @@ -208,15 +202,12 @@ where } #[op] -async fn op_net_leave_multi_v4_udp( +async fn op_net_leave_multi_v4_udp( state: Rc>, rid: ResourceId, address: String, multi_interface: String, -) -> Result<(), AnyError> -where - NP: NetPermissions + 'static, -{ +) -> Result<(), AnyError> { let resource = state .borrow_mut() .resource_table @@ -233,15 +224,12 @@ where } #[op] -async fn op_net_leave_multi_v6_udp( +async fn op_net_leave_multi_v6_udp( state: Rc>, rid: ResourceId, address: String, multi_interface: u32, -) -> Result<(), AnyError> -where - NP: NetPermissions + 'static, -{ +) -> Result<(), AnyError> { let resource = state .borrow_mut() .resource_table @@ -257,15 +245,12 @@ where } #[op] -async fn op_net_set_multi_loopback_udp( +async fn op_net_set_multi_loopback_udp( state: Rc>, rid: ResourceId, is_v4_membership: bool, loopback: bool, -) -> Result<(), AnyError> -where - NP: NetPermissions + 'static, -{ +) -> Result<(), AnyError> { let resource = state .borrow_mut() .resource_table @@ -283,14 +268,11 @@ where } #[op] -async fn op_net_set_multi_ttl_udp( +async fn op_net_set_multi_ttl_udp( state: Rc>, rid: ResourceId, ttl: u32, -) -> Result<(), AnyError> -where - NP: NetPermissions + 'static, -{ +) -> Result<(), AnyError> { let resource = state .borrow_mut() .resource_table diff --git a/ext/web/lib.rs b/ext/web/lib.rs index adbc9f2622..b1e0dd5d8d 100644 --- a/ext/web/lib.rs +++ b/ext/web/lib.rs @@ -142,7 +142,7 @@ fn op_base64_atob(mut s: ByteString) -> Result { fn forgiving_base64_decode_inplace( input: &mut [u8], ) -> Result { - let error: _ = + let error = || DomExceptionInvalidCharacterError::new("Failed to decode base64"); let decoded = base64_simd::forgiving_decode_inplace(input).map_err(|_| error())?; diff --git a/runtime/permissions/mod.rs b/runtime/permissions/mod.rs index f1d0362cad..e3ddd8cf49 100644 --- a/runtime/permissions/mod.rs +++ b/runtime/permissions/mod.rs @@ -18,6 +18,7 @@ use deno_core::ModuleSpecifier; use deno_core::OpState; use log; use once_cell::sync::Lazy; +use std::borrow::Cow; use std::collections::HashSet; use std::fmt; use std::hash::Hash; @@ -872,8 +873,8 @@ impl UnaryPermission { .ok_or_else(|| uri_error("Missing host"))? .to_string(); let display_host = match url.port() { - None => hostname.clone(), - Some(port) => format!("{hostname}:{port}"), + None => Cow::Borrowed(&hostname), + Some(port) => Cow::Owned(format!("{hostname}:{port}")), }; let host = &(&hostname, url.port_or_known_default()); let (result, prompted, is_allow_all) = self.query(Some(host)).check( diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 434cca4575..f15cd1c929 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.68.2" +channel = "1.70.0" components = ["rustfmt", "clippy"]