From f9459a8adf28de02d44dfe1da243a1d66a6ec41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 17 Apr 2024 14:42:11 +0900 Subject: [PATCH] build(cargo): Update `rustc` to `nightly-2024-04-16` (#8870) --- Cargo.lock | 4 +-- bindings/Cargo.lock | 10 ++----- bindings/binding_core_node/Cargo.toml | 1 - bindings/binding_core_wasm/Cargo.toml | 1 - bindings/binding_minifier_node/Cargo.toml | 1 - bindings/binding_minifier_wasm/Cargo.toml | 1 - bindings/node_macro_deps/Cargo.toml | 3 +-- bindings/swc_cli/Cargo.toml | 1 - crates/swc/src/config/mod.rs | 1 - crates/swc_common/src/source_map.rs | 4 +-- .../tests/fixture/stub_napi/Cargo.toml | 1 - .../tests/fixture/stub_wasm/Cargo.toml | 1 - crates/swc_css_codegen/src/lib.rs | 1 + crates/swc_css_utils/src/lib.rs | 4 +-- crates/swc_ecma_codegen/src/lib.rs | 1 + .../src/destructuring.rs | 4 +-- crates/swc_ecma_parser/src/lexer/number.rs | 6 ++--- .../src/json_parse.rs | 2 -- crates/swc_ecma_utils/src/lib.rs | 26 +++++++------------ crates/swc_html_codegen/src/lib.rs | 1 + .../css-plugins/swc_noop_plugin/Cargo.toml | 1 - .../tests/fixture/issue_6404/Cargo.toml | 1 - .../fixture/swc_internal_plugin/Cargo.toml | 1 - .../tests/fixture/swc_noop_plugin/Cargo.toml | 1 - crates/swc_xml_codegen/src/lib.rs | 1 + rust-toolchain | 2 +- 26 files changed, 28 insertions(+), 53 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 26b5e38f66b6..dcdf40456648 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2852,9 +2852,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] diff --git a/bindings/Cargo.lock b/bindings/Cargo.lock index bbbb27ef461e..f915ee11d61f 100644 --- a/bindings/Cargo.lock +++ b/bindings/Cargo.lock @@ -219,7 +219,6 @@ dependencies = [ "napi-derive", "node_macro_deps", "path-clean 0.1.0", - "proc-macro2", "serde", "serde_json", "swc_core", @@ -236,7 +235,6 @@ version = "1.4.15-nightly-20240416.4" dependencies = [ "anyhow", "getrandom", - "proc-macro2", "serde", "serde-wasm-bindgen", "swc_core", @@ -276,7 +274,6 @@ dependencies = [ "napi-derive", "node_macro_deps", "path-clean 0.1.0", - "proc-macro2", "serde", "serde_json", "sourcemap", @@ -298,7 +295,6 @@ version = "1.4.15-nightly-20240416.4" dependencies = [ "anyhow", "getrandom", - "proc-macro2", "serde", "serde-wasm-bindgen", "swc_core", @@ -1832,7 +1828,6 @@ checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" name = "node_macro_deps" version = "0.1.0" dependencies = [ - "proc-macro2", "quote", ] @@ -2223,9 +2218,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] @@ -3081,7 +3076,6 @@ name = "swc_cli" version = "0.91.220" dependencies = [ "anyhow", - "proc-macro2", "swc_cli_impl", ] diff --git a/bindings/binding_core_node/Cargo.toml b/bindings/binding_core_node/Cargo.toml index e4365e31c786..0cba94d0ec67 100644 --- a/bindings/binding_core_node/Cargo.toml +++ b/bindings/binding_core_node/Cargo.toml @@ -44,7 +44,6 @@ napi-derive = { version = "2", default-features = false, features = [ ] } node_macro_deps = { path = "../node_macro_deps" } path-clean = "0.1" -proc-macro2 = "=1.0.79" serde = { version = "1", features = ["derive"] } serde_json = { version = "1", features = ["unbounded_depth"] } tracing = { version = "0.1.37", features = ["release_max_level_info"] } diff --git a/bindings/binding_core_wasm/Cargo.toml b/bindings/binding_core_wasm/Cargo.toml index 6cfc4ea1072e..008c1046a6df 100644 --- a/bindings/binding_core_wasm/Cargo.toml +++ b/bindings/binding_core_wasm/Cargo.toml @@ -33,7 +33,6 @@ plugin = [] [dependencies] anyhow = "1.0.66" getrandom = { version = "0.2.10", features = ["js"] } -proc-macro2 = "=1.0.79" serde = { version = "1", features = ["derive"] } serde-wasm-bindgen = "0.4.5" swc_core = { version = "0.90.33", features = [ diff --git a/bindings/binding_minifier_node/Cargo.toml b/bindings/binding_minifier_node/Cargo.toml index 65489acb8c66..5330ec0dd560 100644 --- a/bindings/binding_minifier_node/Cargo.toml +++ b/bindings/binding_minifier_node/Cargo.toml @@ -27,7 +27,6 @@ napi-derive = { version = "2", default-features = false, features = [ ] } node_macro_deps = { path = "../node_macro_deps" } path-clean = "0.1" -proc-macro2 = "=1.0.79" serde = { version = "1", features = ["derive"] } serde_json = { version = "1", features = ["unbounded_depth"] } sourcemap = "8.0.0" diff --git a/bindings/binding_minifier_wasm/Cargo.toml b/bindings/binding_minifier_wasm/Cargo.toml index 203aa0ab66e0..ddf018c0d751 100644 --- a/bindings/binding_minifier_wasm/Cargo.toml +++ b/bindings/binding_minifier_wasm/Cargo.toml @@ -33,7 +33,6 @@ plugin = [] [dependencies] anyhow = "1.0.66" getrandom = { version = "0.2.10", features = ["js"] } -proc-macro2 = "=1.0.79" serde = { version = "1", features = ["derive"] } serde-wasm-bindgen = "0.4.5" swc_core = { version = "0.90.33", features = [ diff --git a/bindings/node_macro_deps/Cargo.toml b/bindings/node_macro_deps/Cargo.toml index 6e41c37afae9..41a655dfe1b5 100644 --- a/bindings/node_macro_deps/Cargo.toml +++ b/bindings/node_macro_deps/Cargo.toml @@ -12,5 +12,4 @@ bench = false proc-macro = true [dependencies] -proc-macro2 = "=1.0.79" -quote = "1" +quote = "1" diff --git a/bindings/swc_cli/Cargo.toml b/bindings/swc_cli/Cargo.toml index b7ad2a0530ca..fe20382b9272 100644 --- a/bindings/swc_cli/Cargo.toml +++ b/bindings/swc_cli/Cargo.toml @@ -19,5 +19,4 @@ plugin = ["swc_cli_impl/plugin"] [dependencies] anyhow = "1.0.66" -proc-macro2 = "=1.0.79" swc_cli_impl = "0.8.25" diff --git a/crates/swc/src/config/mod.rs b/crates/swc/src/config/mod.rs index 3364eec44459..3fc62d6ee82b 100644 --- a/crates/swc/src/config/mod.rs +++ b/crates/swc/src/config/mod.rs @@ -3,7 +3,6 @@ use std::{ env, path::{Path, PathBuf}, sync::Arc, - usize, }; use anyhow::{bail, Context, Error}; diff --git a/crates/swc_common/src/source_map.rs b/crates/swc_common/src/source_map.rs index 5fc8967975ff..8832e92fbede 100644 --- a/crates/swc_common/src/source_map.rs +++ b/crates/swc_common/src/source_map.rs @@ -874,9 +874,7 @@ impl SourceMap { // Disregard indexes that are at the start or end of their spans, they can't fit // bigger characters. - if (!forwards && end_index == usize::min_value()) - || (forwards && start_index == usize::max_value()) - { + if (!forwards && end_index == usize::MIN) || (forwards && start_index == usize::MAX) { debug!("find_width_of_character_at_span: start or end of span, cannot be multibyte"); return 1; } diff --git a/crates/swc_core/tests/fixture/stub_napi/Cargo.toml b/crates/swc_core/tests/fixture/stub_napi/Cargo.toml index 841394d5ad67..044a070f42d9 100644 --- a/crates/swc_core/tests/fixture/stub_napi/Cargo.toml +++ b/crates/swc_core/tests/fixture/stub_napi/Cargo.toml @@ -39,7 +39,6 @@ napi-derive = { version = "2", default-features = false, features = [ "type-def", ] } path-clean = "0.1" -proc-macro2 = "=1.0.79" serde = { version = "1", features = ["derive"] } serde_json = { version = "1", features = ["unbounded_depth"] } tracing = { version = "0.1.37", features = ["release_max_level_info"] } diff --git a/crates/swc_core/tests/fixture/stub_wasm/Cargo.toml b/crates/swc_core/tests/fixture/stub_wasm/Cargo.toml index e8b40c293bd7..d12d3403e245 100644 --- a/crates/swc_core/tests/fixture/stub_wasm/Cargo.toml +++ b/crates/swc_core/tests/fixture/stub_wasm/Cargo.toml @@ -17,7 +17,6 @@ swc_v1 = [] [dependencies] anyhow = "1.0.66" browserslist-rs = { version = "0.13.0", features = ["wasm_bindgen"] } -proc-macro2 = "=1.0.79" serde = { version = "1", features = ["derive"] } serde-wasm-bindgen = "0.4.5" swc_core = { path = "../../../../swc_core", features = [ diff --git a/crates/swc_css_codegen/src/lib.rs b/crates/swc_css_codegen/src/lib.rs index 1ccd1ec895ff..d36316421ea4 100644 --- a/crates/swc_css_codegen/src/lib.rs +++ b/crates/swc_css_codegen/src/lib.rs @@ -1,5 +1,6 @@ #![deny(clippy::all)] #![allow(clippy::needless_update)] +#![allow(non_local_definitions)] pub use std::fmt::Result; use std::{borrow::Cow, str, str::from_utf8}; diff --git a/crates/swc_css_utils/src/lib.rs b/crates/swc_css_utils/src/lib.rs index 1fd3f5da9b86..6fbe461405ad 100644 --- a/crates/swc_css_utils/src/lib.rs +++ b/crates/swc_css_utils/src/lib.rs @@ -317,7 +317,7 @@ pub fn hsl_to_rgb(hsl: [f64; 3]) -> [f64; 3] { let k = (n + h / 30.0) % 12.0; let a = s * f64::min(l, 1.0 - l); - l - a * f64::max(-1.0, f64::min(f64::min(k - 3.0, 9.0 - k), 1.0)) + l - a * f64::min(k - 3.0, 9.0 - k).clamp(-1.0, 1.0) }; r = f(0.0); @@ -339,7 +339,7 @@ pub fn to_rgb255(abc: [f64; 3]) -> [f64; 3] { } pub fn clamp_unit_f64(val: f64) -> u8 { - (val * 255.).round().max(0.).min(255.) as u8 + (val * 255.).round().clamp(0., 255.) as u8 } pub fn round_alpha(alpha: f64) -> f64 { diff --git a/crates/swc_ecma_codegen/src/lib.rs b/crates/swc_ecma_codegen/src/lib.rs index d5bd57cbea21..d365aee75538 100644 --- a/crates/swc_ecma_codegen/src/lib.rs +++ b/crates/swc_ecma_codegen/src/lib.rs @@ -3,6 +3,7 @@ #![deny(unused)] #![allow(clippy::match_like_matches_macro)] #![allow(clippy::nonminimal_bool)] +#![allow(non_local_definitions)] use std::{borrow::Cow, fmt::Write, io}; diff --git a/crates/swc_ecma_compat_es2015/src/destructuring.rs b/crates/swc_ecma_compat_es2015/src/destructuring.rs index 7a14ba5c6384..4796b4c2c112 100644 --- a/crates/swc_ecma_compat_es2015/src/destructuring.rs +++ b/crates/swc_ecma_compat_es2015/src/destructuring.rs @@ -228,7 +228,7 @@ impl AssignFolder { }, Some(init), Some(if has_rest_pat(&elems) { - std::usize::MAX + usize::MAX } else { elems.len() }), @@ -721,7 +721,7 @@ impl VisitMut for AssignFolder { &mut self.vars, None, Some(if has_rest_pat(elems) { - std::usize::MAX + usize::MAX } else { elems.len() }), diff --git a/crates/swc_ecma_parser/src/lexer/number.rs b/crates/swc_ecma_parser/src/lexer/number.rs index bd77f22e22ff..c093345a702a 100644 --- a/crates/swc_ecma_parser/src/lexer/number.rs +++ b/crates/swc_ecma_parser/src/lexer/number.rs @@ -536,7 +536,7 @@ impl<'a> Lexer<'a> { #[cfg(test)] mod tests { - use std::{f64::INFINITY, panic}; + use std::panic; use super::*; @@ -576,7 +576,7 @@ mod tests { 0000000000000000000000000000000000000000000000000000"; #[test] fn num_inf() { - assert_eq!(num(LONG), (INFINITY, LONG.into())); + assert_eq!(num(LONG), (f64::INFINITY, LONG.into())); } /// Number >= 2^53 @@ -625,7 +625,7 @@ mod tests { assert_eq!( num(LARGE_POSITIVE_EXP), - (INFINITY, LARGE_POSITIVE_EXP.into()) + (f64::INFINITY, LARGE_POSITIVE_EXP.into()) ); assert_eq!(num(LARGE_NEGATIVE_EXP), (0.0, LARGE_NEGATIVE_EXP.into())); assert_eq!( diff --git a/crates/swc_ecma_transforms_optimization/src/json_parse.rs b/crates/swc_ecma_transforms_optimization/src/json_parse.rs index ae5b621e920d..e873f59e9704 100644 --- a/crates/swc_ecma_transforms_optimization/src/json_parse.rs +++ b/crates/swc_ecma_transforms_optimization/src/json_parse.rs @@ -1,5 +1,3 @@ -use std::usize; - use serde_json::Value; use swc_common::{util::take::Take, Spanned, DUMMY_SP}; use swc_ecma_ast::*; diff --git a/crates/swc_ecma_utils/src/lib.rs b/crates/swc_ecma_utils/src/lib.rs index 63593363812d..f2937ba7eef7 100644 --- a/crates/swc_ecma_utils/src/lib.rs +++ b/crates/swc_ecma_utils/src/lib.rs @@ -11,13 +11,7 @@ pub extern crate swc_ecma_ast; #[doc(hidden)] pub extern crate swc_common; -use std::{ - borrow::Cow, - f64::{INFINITY, NAN}, - hash::Hash, - num::FpCategory, - ops::Add, -}; +use std::{borrow::Cow, hash::Hash, num::FpCategory, ops::Add}; use rustc_hash::FxHashMap; use swc_atoms::JsWord; @@ -891,8 +885,8 @@ pub trait ExprExt { _ => return (Pure, Unknown), }, Expr::Ident(Ident { sym, span, .. }) => match &**sym { - "undefined" | "NaN" if span.ctxt == ctx.unresolved_ctxt => NAN, - "Infinity" if span.ctxt == ctx.unresolved_ctxt => INFINITY, + "undefined" | "NaN" if span.ctxt == ctx.unresolved_ctxt => f64::NAN, + "Infinity" if span.ctxt == ctx.unresolved_ctxt => f64::INFINITY, _ => return (Pure, Unknown), }, Expr::Unary(UnaryExpr { @@ -908,7 +902,7 @@ pub trait ExprExt { }) if &**sym == "Infinity" && span.ctxt == ctx.unresolved_ctxt ) => { - -INFINITY + -f64::INFINITY } Expr::Unary(UnaryExpr { op: op!("!"), @@ -930,9 +924,9 @@ pub trait ExprExt { .. }) => { if arg.may_have_side_effects(ctx) { - return (MayBeImpure, Known(NAN)); + return (MayBeImpure, Known(f64::NAN)); } else { - NAN + f64::NAN } } @@ -1578,19 +1572,19 @@ pub fn num_from_str(s: &str) -> Value { b"0x" | b"0X" => { return match u64::from_str_radix(&s[2..], 16) { Ok(n) => Known(n as f64), - Err(_) => Known(NAN), + Err(_) => Known(f64::NAN), } } b"0o" | b"0O" => { return match u64::from_str_radix(&s[2..], 8) { Ok(n) => Known(n as f64), - Err(_) => Known(NAN), + Err(_) => Known(f64::NAN), }; } b"0b" | b"0B" => { return match u64::from_str_radix(&s[2..], 2) { Ok(n) => Known(n as f64), - Err(_) => Known(NAN), + Err(_) => Known(f64::NAN), }; } _ => {} @@ -1611,7 +1605,7 @@ pub fn num_from_str(s: &str) -> Value { _ => {} } - Known(s.parse().ok().unwrap_or(NAN)) + Known(s.parse().ok().unwrap_or(f64::NAN)) } impl ExprExt for Box { diff --git a/crates/swc_html_codegen/src/lib.rs b/crates/swc_html_codegen/src/lib.rs index fd055b427520..aecbad102a30 100644 --- a/crates/swc_html_codegen/src/lib.rs +++ b/crates/swc_html_codegen/src/lib.rs @@ -1,6 +1,7 @@ #![deny(clippy::all)] #![allow(clippy::needless_update)] #![allow(clippy::match_like_matches_macro)] +#![allow(non_local_definitions)] pub use std::fmt::Result; use std::{borrow::Cow, iter::Peekable, str::Chars}; diff --git a/crates/swc_plugin_runner/tests/css-plugins/swc_noop_plugin/Cargo.toml b/crates/swc_plugin_runner/tests/css-plugins/swc_noop_plugin/Cargo.toml index d46c7c433282..d03b359d9058 100644 --- a/crates/swc_plugin_runner/tests/css-plugins/swc_noop_plugin/Cargo.toml +++ b/crates/swc_plugin_runner/tests/css-plugins/swc_noop_plugin/Cargo.toml @@ -10,7 +10,6 @@ version = "0.1.0" crate-type = ["cdylib"] [dependencies] -proc-macro2 = "=1.0.79" serde = "1" swc_core = { path = "../../../../swc_core", features = [ "css_ast", diff --git a/crates/swc_plugin_runner/tests/fixture/issue_6404/Cargo.toml b/crates/swc_plugin_runner/tests/fixture/issue_6404/Cargo.toml index ed9627fd027b..77690a680939 100644 --- a/crates/swc_plugin_runner/tests/fixture/issue_6404/Cargo.toml +++ b/crates/swc_plugin_runner/tests/fixture/issue_6404/Cargo.toml @@ -10,7 +10,6 @@ version = "0.1.0" crate-type = ["cdylib"] [dependencies] -proc-macro2 = "=1.0.79" serde = "1" swc_core = { path = "../../../../swc_core", features = [ "ecma_plugin_transform", diff --git a/crates/swc_plugin_runner/tests/fixture/swc_internal_plugin/Cargo.toml b/crates/swc_plugin_runner/tests/fixture/swc_internal_plugin/Cargo.toml index 51922415f44f..4909641da2d6 100644 --- a/crates/swc_plugin_runner/tests/fixture/swc_internal_plugin/Cargo.toml +++ b/crates/swc_plugin_runner/tests/fixture/swc_internal_plugin/Cargo.toml @@ -10,7 +10,6 @@ version = "0.1.0" crate-type = ["cdylib"] [dependencies] -proc-macro2 = "=1.0.79" serde = "1" swc_core = { path = "../../../../swc_core", features = [ "ecma_plugin_transform", diff --git a/crates/swc_plugin_runner/tests/fixture/swc_noop_plugin/Cargo.toml b/crates/swc_plugin_runner/tests/fixture/swc_noop_plugin/Cargo.toml index a878b20674aa..123d8ee93798 100644 --- a/crates/swc_plugin_runner/tests/fixture/swc_noop_plugin/Cargo.toml +++ b/crates/swc_plugin_runner/tests/fixture/swc_noop_plugin/Cargo.toml @@ -10,7 +10,6 @@ version = "0.1.0" crate-type = ["cdylib"] [dependencies] -proc-macro2 = "=1.0.79" serde = "1" swc_core = { path = "../../../../swc_core", features = [ "ecma_plugin_transform", diff --git a/crates/swc_xml_codegen/src/lib.rs b/crates/swc_xml_codegen/src/lib.rs index 84a49095f1b1..f2659c08b853 100644 --- a/crates/swc_xml_codegen/src/lib.rs +++ b/crates/swc_xml_codegen/src/lib.rs @@ -1,5 +1,6 @@ #![deny(clippy::all)] #![allow(clippy::needless_update)] +#![allow(non_local_definitions)] pub use std::fmt::Result; use std::{iter::Peekable, str::Chars}; diff --git a/rust-toolchain b/rust-toolchain index f1104daa0f34..c8dce96fac4a 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2024-04-03 \ No newline at end of file +nightly-2024-04-16 \ No newline at end of file