From b1ff9f4b216c6e52febecdb56f13e8f0dda6db37 Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Fri, 22 Sep 2023 10:57:14 -0700 Subject: [PATCH] Update rust toolchain to nightly-2023-09-21 (#6002) This: - Updates to the latest api change for `StdError` in `error_generic_member_access` rust-lang/rust#99301 - Updates `pathfinder_simd` for compatiblity - Updates other crates for compatibility with Next.js Closes WEB-1635 --- .cargo/config.toml | 2 +- .github/workflows/test.yml | 2 +- Cargo.lock | 53 +++++-------------- Cargo.toml | 3 +- crates/turbo-tasks-macros/src/lib.rs | 1 + crates/turbo-tasks/src/backend.rs | 15 +++--- crates/turbo-tasks/src/lib.rs | 1 - crates/turbo-tasks/src/manager.rs | 2 +- crates/turbo-tasks/src/util.rs | 2 +- crates/turbopack-cli-utils/src/issue.rs | 12 ++--- crates/turbopack-convert-trace/src/main.rs | 2 +- crates/turbopack-core/src/issue/mod.rs | 2 +- .../src/ecmascript/list/content.rs | 21 ++++---- .../turbopack-ecmascript/src/analyzer/mod.rs | 18 +++---- crates/turborepo-api-client/src/lib.rs | 1 - crates/turborepo-cache/src/lib.rs | 1 - crates/turborepo-lib/src/lib.rs | 1 - crates/turborepo-scm/src/lib.rs | 1 - rust-toolchain | 2 +- xtask/src/publish.rs | 2 +- 20 files changed, 53 insertions(+), 91 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 88ccbdfd4d9be8..1ed474fb26ce53 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -32,5 +32,5 @@ rustflags = [ # Clippy's needless mut lint is buggy: https://github.com/rust-lang/rust-clippy/issues/11299 "-Aclippy::needless_pass_by_ref_mut", # Clippy's partial_eq lint is buggy: https://github.com/rust-lang/rust-clippy/issues/11178 - "-Aclippy::incorrect_partial_ord_impl_on_ord_type", + "-Aclippy::non_canonical_partial_ord_impl", ] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 920a6578af265d..b0a8964f75d4d5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -603,7 +603,7 @@ jobs: - name: Run cargo clippy run: | - RUSTFLAGS="-D warnings -A deprecated -Aclippy::too_many_arguments -Aclippy::needless_pass_by_ref_mut -Aclippy::incorrect_partial_ord_impl_on_ord_type" cargo groups clippy turbopack --features rustls-tls + RUSTFLAGS="-D warnings -A deprecated -Aclippy::too_many_arguments -Aclippy::needless_pass_by_ref_mut -Aclippy::non_canonical_partial_ord_impl" cargo groups clippy turbopack --features rustls-tls - name: Run ast-grep lints run: | diff --git a/Cargo.lock b/Cargo.lock index f2e12857f49ef3..23d81f338fc619 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1376,15 +1376,15 @@ dependencies = [ [[package]] name = "console" -version = "0.15.5" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" +checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" dependencies = [ "encode_unicode", "lazy_static", "libc", "unicode-width", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -5062,11 +5062,11 @@ dependencies = [ [[package]] name = "pathfinder_simd" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39fe46acc5503595e5949c17b818714d26fdf9b4920eacf3b2947f0199f4a6ff" +checksum = "0444332826c70dc47be74a7c6a5fc44e23a7905ad6858d4162b658320455ef93" dependencies = [ - "rustc_version 0.3.3", + "rustc_version 0.4.0", ] [[package]] @@ -6142,15 +6142,6 @@ dependencies = [ "semver 0.9.0", ] -[[package]] -name = "rustc_version" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver 0.11.0", -] - [[package]] name = "rustc_version" version = "0.4.0" @@ -6317,16 +6308,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0", -] - -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser 0.10.2", + "semver-parser", ] [[package]] @@ -6344,15 +6326,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - [[package]] name = "serde" version = "1.0.171" @@ -6622,9 +6595,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" [[package]] name = "signal-hook" @@ -8466,18 +8439,18 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.44" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.44" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 972400770331eb..8f7c03f42aaa27 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -226,8 +226,7 @@ sourcemap = "6.0.2" syn = "1.0.107" tempfile = "3.3.0" test-case = "3.0.0" -# pinned due to 1.0.45 requiring toolchain update -thiserror = "<1.0.45" +thiserror = "1.0.48" tiny-gradient = "0.1.0" tokio = "1.25.0" tokio-util = { version = "0.7.7", features = ["io"] } diff --git a/crates/turbo-tasks-macros/src/lib.rs b/crates/turbo-tasks-macros/src/lib.rs index 66c23049729607..0e5f3b77b49d23 100644 --- a/crates/turbo-tasks-macros/src/lib.rs +++ b/crates/turbo-tasks-macros/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(internal_features)] #![feature(proc_macro_diagnostic)] #![feature(allow_internal_unstable)] #![feature(box_patterns)] diff --git a/crates/turbo-tasks/src/backend.rs b/crates/turbo-tasks/src/backend.rs index ba488fa70fdb04..5d2947afdd5f5e 100644 --- a/crates/turbo-tasks/src/backend.rs +++ b/crates/turbo-tasks/src/backend.rs @@ -2,7 +2,7 @@ use std::{ any::Any, borrow::Cow, fmt, - fmt::{Debug, Display}, + fmt::{Debug, Display, Write}, future::Future, pin::Pin, sync::Arc, @@ -383,11 +383,14 @@ impl PersistentTaskType { } Err(name) => { if !this_value.has_trait(trait_type) { - let traits = this_value - .traits() - .iter() - .map(|t| format!(" {}", t)) - .collect::(); + let traits = + this_value + .traits() + .iter() + .fold(String::new(), |mut out, t| { + let _ = write!(out, " {}", t); + out + }); Err(anyhow!( "{} doesn't implement {} (only{})", this_value, diff --git a/crates/turbo-tasks/src/lib.rs b/crates/turbo-tasks/src/lib.rs index f6ceda8d11fb0a..b1c63a74139036 100644 --- a/crates/turbo-tasks/src/lib.rs +++ b/crates/turbo-tasks/src/lib.rs @@ -29,7 +29,6 @@ #![deny(unsafe_op_in_unsafe_fn)] #![feature(result_flattening)] #![feature(error_generic_member_access)] -#![feature(provide_any)] #![feature(new_uninit)] #![feature(arbitrary_self_types)] #![feature(async_fn_in_trait)] diff --git a/crates/turbo-tasks/src/manager.rs b/crates/turbo-tasks/src/manager.rs index 6aa0b6bd12031c..f4791dc31eb8ee 100644 --- a/crates/turbo-tasks/src/manager.rs +++ b/crates/turbo-tasks/src/manager.rs @@ -1341,7 +1341,7 @@ pub fn with_turbo_tasks(func: impl FnOnce(&Arc) -> T) -> T } pub fn weak_turbo_tasks() -> Weak { - TURBO_TASKS.with(|arc| Arc::downgrade(arc)) + TURBO_TASKS.with(Arc::downgrade) } pub fn with_turbo_tasks_for_testing( diff --git a/crates/turbo-tasks/src/util.rs b/crates/turbo-tasks/src/util.rs index 497b1a6bcc2aec..bdc385028bb666 100644 --- a/crates/turbo-tasks/src/util.rs +++ b/crates/turbo-tasks/src/util.rs @@ -38,7 +38,7 @@ impl StdError for SharedError { self.inner.source() } - fn provide<'a>(&'a self, req: &mut std::any::Demand<'a>) { + fn provide<'a>(&'a self, req: &mut std::error::Request<'a>) { self.inner.provide(req); } } diff --git a/crates/turbopack-cli-utils/src/issue.rs b/crates/turbopack-cli-utils/src/issue.rs index 330aa822934de3..16ee92b0343284 100644 --- a/crates/turbopack-cli-utils/src/issue.rs +++ b/crates/turbopack-cli-utils/src/issue.rs @@ -397,15 +397,9 @@ impl IssueReporter for ConsoleUi { let category = &plain_issue.category; let title = &plain_issue.title; let processing_path = &*plain_issue.processing_path; - let severity_map = grouped_issues - .entry(severity) - .or_insert_with(Default::default); - let category_map = severity_map - .entry(category.clone()) - .or_insert_with(Default::default); - let issues = category_map - .entry(context_path.to_string()) - .or_insert_with(Default::default); + let severity_map = grouped_issues.entry(severity).or_default(); + let category_map = severity_map.entry(category.clone()).or_default(); + let issues = category_map.entry(context_path.to_string()).or_default(); let mut styled_issue = if let Some(source) = &plain_issue.source { let mut styled_issue = format!( diff --git a/crates/turbopack-convert-trace/src/main.rs b/crates/turbopack-convert-trace/src/main.rs index 804df1bf7b3240..e298d86cd0ee17 100644 --- a/crates/turbopack-convert-trace/src/main.rs +++ b/crates/turbopack-convert-trace/src/main.rs @@ -599,7 +599,7 @@ fn main() { ); add_to_span_counter(); } else { - let group = groups.entry(key).or_insert_with(Vec::new); + let group = groups.entry(key).or_default(); if !group.is_empty() { add_to_span_counter(); } diff --git a/crates/turbopack-core/src/issue/mod.rs b/crates/turbopack-core/src/issue/mod.rs index 74be2821950c5b..146528071a6793 100644 --- a/crates/turbopack-core/src/issue/mod.rs +++ b/crates/turbopack-core/src/issue/mod.rs @@ -391,7 +391,7 @@ impl CapturedIssues { }) .try_join() .await?; - list.sort_by(|a, b| ReadRef::ptr_cmp(a, b)); + list.sort_by(ReadRef::ptr_cmp); Ok(list) } } diff --git a/crates/turbopack-dev/src/ecmascript/list/content.rs b/crates/turbopack-dev/src/ecmascript/list/content.rs index 08b14ee8107baf..478de6c10d54c7 100644 --- a/crates/turbopack-dev/src/ecmascript/list/content.rs +++ b/crates/turbopack-dev/src/ecmascript/list/content.rs @@ -93,18 +93,15 @@ impl EcmascriptDevChunkListContent { let by_merger = by_merger .into_iter() - .map(|(merger, contents)| { - let merger = merger; - async move { - Ok(( - merger, - merger - .merge(Vc::cell(contents)) - .version() - .into_trait_ref() - .await?, - )) - } + .map(|(merger, contents)| async move { + Ok(( + merger, + merger + .merge(Vc::cell(contents)) + .version() + .into_trait_ref() + .await?, + )) }) .try_join() .await? diff --git a/crates/turbopack-ecmascript/src/analyzer/mod.rs b/crates/turbopack-ecmascript/src/analyzer/mod.rs index c7f327cc9310b6..9def37b29946d3 100644 --- a/crates/turbopack-ecmascript/src/analyzer/mod.rs +++ b/crates/turbopack-ecmascript/src/analyzer/mod.rs @@ -3,7 +3,7 @@ use std::{ borrow::Cow, cmp::Ordering, - fmt::Display, + fmt::{Display, Write}, future::Future, hash::{Hash, Hasher}, mem::take, @@ -1044,10 +1044,10 @@ impl JsValue { let explainer = pretty_join(&args, 0, ", ", ",", ""); ( explainer, - hints - .into_iter() - .map(|h| format!("\n{h}")) - .collect::(), + hints.into_iter().fold(String::new(), |mut out, h| { + let _ = write!(out, "\n{h}"); + out + }), ) } @@ -1056,10 +1056,10 @@ impl JsValue { let explainer = self.explain_internal(&mut hints, 0, depth, unknown_depth); ( explainer, - hints - .into_iter() - .map(|h| format!("\n{h}")) - .collect::(), + hints.into_iter().fold(String::new(), |mut out, h| { + let _ = write!(out, "\n{h}"); + out + }), ) } diff --git a/crates/turborepo-api-client/src/lib.rs b/crates/turborepo-api-client/src/lib.rs index 4b534ea08b0324..dfb4e1458f0842 100644 --- a/crates/turborepo-api-client/src/lib.rs +++ b/crates/turborepo-api-client/src/lib.rs @@ -1,5 +1,4 @@ #![feature(async_closure)] -#![feature(provide_any)] #![feature(error_generic_member_access)] #![deny(clippy::all)] diff --git a/crates/turborepo-cache/src/lib.rs b/crates/turborepo-cache/src/lib.rs index 3eeba96461f8b3..e094ec891d571b 100644 --- a/crates/turborepo-cache/src/lib.rs +++ b/crates/turborepo-cache/src/lib.rs @@ -1,5 +1,4 @@ #![feature(error_generic_member_access)] -#![feature(provide_any)] #![feature(assert_matches)] #![feature(box_patterns)] #![deny(clippy::all)] diff --git a/crates/turborepo-lib/src/lib.rs b/crates/turborepo-lib/src/lib.rs index 612f507452ae0e..4356b8f7f58b9f 100644 --- a/crates/turborepo-lib/src/lib.rs +++ b/crates/turborepo-lib/src/lib.rs @@ -1,7 +1,6 @@ #![feature(assert_matches)] #![feature(box_patterns)] #![feature(error_generic_member_access)] -#![feature(provide_any)] #![feature(hash_extract_if)] #![feature(option_get_or_insert_default)] #![feature(once_cell_try)] diff --git a/crates/turborepo-scm/src/lib.rs b/crates/turborepo-scm/src/lib.rs index c43b45da44f6af..0b2e296b5ce37b 100644 --- a/crates/turborepo-scm/src/lib.rs +++ b/crates/turborepo-scm/src/lib.rs @@ -1,5 +1,4 @@ #![feature(error_generic_member_access)] -#![feature(provide_any)] #![feature(assert_matches)] #![deny(clippy::all)] diff --git a/rust-toolchain b/rust-toolchain index cd9bf832ae2a4e..fe109472d242da 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2023-07-21 +nightly-2023-09-21 diff --git a/xtask/src/publish.rs b/xtask/src/publish.rs index f9e8e72a0c6aa5..50847283487e24 100644 --- a/xtask/src/publish.rs +++ b/xtask/src/publish.rs @@ -249,8 +249,8 @@ pub fn run_bump(names: HashSet, dry_run: bool) { .collect::>(); let mut workspaces_to_bump = workspaces .iter() + .filter(|&p| names.contains(&p.name)) .cloned() - .filter(|p| names.contains(&p.name)) .collect::>(); if workspaces_to_bump.is_empty() { fn name_to_title(package: &PackageJson) -> String {