From 368b9e2ff278eebf63636a44349add4cf940096d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 9 Nov 2021 14:20:02 +0900 Subject: [PATCH] chore: Update rustc to prevent `CVE-2021-42574` (#2690) --- Cargo.lock | 2 +- bundler/src/bundler/chunk/merge.rs | 4 +-- common/src/sync.rs | 4 +-- ecmascript/ext-transforms/src/jest.rs | 4 +-- .../minifier/src/compress/hoist_decls.rs | 4 +-- .../src/compress/optimize/join_vars.rs | 4 +-- .../src/compress/optimize/sequences.rs | 25 +++++-------------- .../minifier/src/compress/pure/arrows.rs | 4 +-- .../minifier/src/compress/pure/strings.rs | 3 +-- ecmascript/minifier/src/compress/pure/vars.rs | 4 +-- ecmascript/parser/src/parser/pat.rs | 8 ++---- .../compat/src/es2015/regenerator/case.rs | 4 +-- .../compat/src/es2017/async_to_generator.rs | 4 +-- .../compat/src/es2020/opt_chaining.rs | 4 +-- .../optimization/src/simplify/branch/mod.rs | 4 +-- macros/common/src/prelude.rs | 2 +- package.json | 2 +- rust-toolchain | 2 +- wasm/Cargo.toml | 2 +- 19 files changed, 26 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c76f67765c..bdfb25890dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3583,7 +3583,7 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm" -version = "1.2.107" +version = "1.2.108" dependencies = [ "anyhow", "console_error_panic_hook", diff --git a/bundler/src/bundler/chunk/merge.rs b/bundler/src/bundler/chunk/merge.rs index 635f7e2a8c8..dce6efc4911 100644 --- a/bundler/src/bundler/chunk/merge.rs +++ b/bundler/src/bundler/chunk/merge.rs @@ -340,9 +340,7 @@ where for (_, stmt) in entry.iter_mut() { let var = match stmt { ModuleItem::Stmt(Stmt::Decl(Decl::Var( - var - @ - VarDecl { + var @ VarDecl { kind: VarDeclKind::Const, .. }, diff --git a/common/src/sync.rs b/common/src/sync.rs index e2ce4864a28..a69f5d705b5 100644 --- a/common/src/sync.rs +++ b/common/src/sync.rs @@ -77,8 +77,8 @@ mod single { pub use std::{ cell::{ - Ref as ReadGuard, Ref as MappedReadGuard, RefMut as WriteGuard, - RefMut as MappedWriteGuard, RefMut as LockGuard, RefMut as MappedLockGuard, + Ref as ReadGuard, RefMut as WriteGuard, RefMut as MappedWriteGuard, + RefMut as LockGuard, RefMut as MappedLockGuard, }, rc::{Rc as Lrc, Weak}, }; diff --git a/ecmascript/ext-transforms/src/jest.rs b/ecmascript/ext-transforms/src/jest.rs index 127d344c4d4..84a3380244d 100644 --- a/ecmascript/ext-transforms/src/jest.rs +++ b/ecmascript/ext-transforms/src/jest.rs @@ -40,9 +40,7 @@ impl Jest { .. }) => match &**callee { Expr::Member( - callee - @ - MemberExpr { + callee @ MemberExpr { computed: false, .. }, ) => match &callee.obj { diff --git a/ecmascript/minifier/src/compress/hoist_decls.rs b/ecmascript/minifier/src/compress/hoist_decls.rs index 4f2b6b75a5a..84be35ea5cb 100644 --- a/ecmascript/minifier/src/compress/hoist_decls.rs +++ b/ecmascript/minifier/src/compress/hoist_decls.rs @@ -94,9 +94,7 @@ impl Hoister<'_> { } Stmt::Decl(Decl::Var( - var - @ - VarDecl { + var @ VarDecl { kind: VarDeclKind::Var, .. }, diff --git a/ecmascript/minifier/src/compress/optimize/join_vars.rs b/ecmascript/minifier/src/compress/optimize/join_vars.rs index e3feb72e064..41b41db0eb2 100644 --- a/ecmascript/minifier/src/compress/optimize/join_vars.rs +++ b/ecmascript/minifier/src/compress/optimize/join_vars.rs @@ -79,9 +79,7 @@ where }, Stmt::For(mut stmt) => match &mut stmt.init { Some(VarDeclOrExpr::VarDecl( - var - @ - VarDecl { + var @ VarDecl { kind: VarDeclKind::Var, .. }, diff --git a/ecmascript/minifier/src/compress/optimize/sequences.rs b/ecmascript/minifier/src/compress/optimize/sequences.rs index f3b81e0d293..bf1a66bf8cc 100644 --- a/ecmascript/minifier/src/compress/optimize/sequences.rs +++ b/ecmascript/minifier/src/compress/optimize/sequences.rs @@ -95,9 +95,7 @@ where | Stmt::ForOf(..) => true, Stmt::Decl(Decl::Var( - v - @ - VarDecl { + v @ VarDecl { kind: VarDeclKind::Var, .. }, @@ -118,9 +116,7 @@ where if stmts.len() == 2 { match stmts[1].as_stmt() { Some(Stmt::Decl(Decl::Var( - v - @ - VarDecl { + v @ VarDecl { kind: VarDeclKind::Var, .. }, @@ -198,10 +194,7 @@ where Stmt::For(mut stmt @ ForStmt { init: None, .. }) | Stmt::For( - mut - stmt - @ - ForStmt { + mut stmt @ ForStmt { init: Some(VarDeclOrExpr::Expr(..)), .. }, @@ -291,9 +284,7 @@ where } Stmt::Decl(Decl::Var( - var - @ - VarDecl { + var @ VarDecl { kind: VarDeclKind::Var, .. }, @@ -515,9 +506,7 @@ where for stmt in &mut bs.stmts { match stmt { Stmt::Decl(Decl::Var( - v - @ - VarDecl { + v @ VarDecl { kind: VarDeclKind::Var, .. }, @@ -619,9 +608,7 @@ where Some(match s { Stmt::Expr(e) => vec![Mergable::Expr(&mut *e.expr)], Stmt::Decl(Decl::Var( - v - @ - VarDecl { + v @ VarDecl { kind: VarDeclKind::Var | VarDeclKind::Let, .. }, diff --git a/ecmascript/minifier/src/compress/pure/arrows.rs b/ecmascript/minifier/src/compress/pure/arrows.rs index d9a08c2a3b4..39fb80e86d4 100644 --- a/ecmascript/minifier/src/compress/pure/arrows.rs +++ b/ecmascript/minifier/src/compress/pure/arrows.rs @@ -48,9 +48,7 @@ where match &mut *kv.value { Expr::Arrow( - m - @ - ArrowExpr { + m @ ArrowExpr { body: BlockStmtOrExpr::BlockStmt(..), .. }, diff --git a/ecmascript/minifier/src/compress/pure/strings.rs b/ecmascript/minifier/src/compress/pure/strings.rs index 6ac3df8f7f3..229ca9e7011 100644 --- a/ecmascript/minifier/src/compress/pure/strings.rs +++ b/ecmascript/minifier/src/compress/pure/strings.rs @@ -199,8 +199,7 @@ where }, ) => match &mut *bin.left { Expr::Bin( - left - @ BinExpr { + left @ BinExpr { op: op!(bin, "+"), .. }, ) => { diff --git a/ecmascript/minifier/src/compress/pure/vars.rs b/ecmascript/minifier/src/compress/pure/vars.rs index 9e2efc4a574..3aabf4cf24e 100644 --- a/ecmascript/minifier/src/compress/pure/vars.rs +++ b/ecmascript/minifier/src/compress/pure/vars.rs @@ -33,9 +33,7 @@ where for stmt in &*stmts { match stmt.as_stmt() { Some(Stmt::Decl(Decl::Var( - v - @ - VarDecl { + v @ VarDecl { kind: VarDeclKind::Var, .. }, diff --git a/ecmascript/parser/src/parser/pat.rs b/ecmascript/parser/src/parser/pat.rs index 8966c57146a..6c1335d80e4 100644 --- a/ecmascript/parser/src/parser/pat.rs +++ b/ecmascript/parser/src/parser/pat.rs @@ -586,9 +586,7 @@ impl<'a, I: Tokens> Parser { Ok(Pat::Invalid(Invalid { span })) } Expr::Assign( - assign_expr - @ - AssignExpr { + assign_expr @ AssignExpr { op: AssignOpToken::Assign, .. }, @@ -692,9 +690,7 @@ impl<'a, I: Tokens> Parser { for expr in exprs.drain(..idx_of_rest_not_allowed) { match expr { Some( - expr - @ - ExprOrSpread { + expr @ ExprOrSpread { spread: Some(..), .. }, ) => { diff --git a/ecmascript/transforms/compat/src/es2015/regenerator/case.rs b/ecmascript/transforms/compat/src/es2015/regenerator/case.rs index 8136ee345ed..cb570ea6a0b 100644 --- a/ecmascript/transforms/compat/src/es2015/regenerator/case.rs +++ b/ecmascript/transforms/compat/src/es2015/regenerator/case.rs @@ -596,9 +596,7 @@ impl CaseHandler<'_> { } Expr::Bin( - e - @ - BinExpr { + e @ BinExpr { op: op!("&&") | op!("||"), .. }, diff --git a/ecmascript/transforms/compat/src/es2017/async_to_generator.rs b/ecmascript/transforms/compat/src/es2017/async_to_generator.rs index c4852336071..110ab708e81 100644 --- a/ecmascript/transforms/compat/src/es2017/async_to_generator.rs +++ b/ecmascript/transforms/compat/src/es2017/async_to_generator.rs @@ -310,9 +310,7 @@ impl Fold for Actual { } Expr::Fn( - expr - @ - FnExpr { + expr @ FnExpr { function: Function { is_async: true, diff --git a/ecmascript/transforms/compat/src/es2020/opt_chaining.rs b/ecmascript/transforms/compat/src/es2020/opt_chaining.rs index 40659f1e2c2..46f79a7c924 100644 --- a/ecmascript/transforms/compat/src/es2020/opt_chaining.rs +++ b/ecmascript/transforms/compat/src/es2020/opt_chaining.rs @@ -504,9 +504,7 @@ impl OptChaining { match *obj { Expr::Member( - obj - @ - MemberExpr { + obj @ MemberExpr { obj: ExprOrSuper::Expr(..), .. }, diff --git a/ecmascript/transforms/optimization/src/simplify/branch/mod.rs b/ecmascript/transforms/optimization/src/simplify/branch/mod.rs index 18c021bfb18..426ea5828ad 100644 --- a/ecmascript/transforms/optimization/src/simplify/branch/mod.rs +++ b/ecmascript/transforms/optimization/src/simplify/branch/mod.rs @@ -528,9 +528,7 @@ impl VisitMut for Remover { if done { match s { Stmt::Decl(Decl::Var( - var - @ - VarDecl { + var @ VarDecl { kind: VarDeclKind::Var, .. }, diff --git a/macros/common/src/prelude.rs b/macros/common/src/prelude.rs index b98ba1141d3..5b292400aa4 100644 --- a/macros/common/src/prelude.rs +++ b/macros/common/src/prelude.rs @@ -7,4 +7,4 @@ pub use super::{ }; pub use proc_macro2::{Delimiter, Group, Literal, Punct, Span, TokenStream, TokenTree}; pub use quote::ToTokens; -pub use syn::punctuated::{Pair as Element, Pair, Punctuated}; +pub use syn::punctuated::{Pair as Element, Punctuated}; diff --git a/package.json b/package.json index bfd30dc2e8b..9c8841b7b20 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@swc/core", - "version": "1.2.107", + "version": "1.2.108", "description": "Super-fast alternative for babel", "homepage": "https://swc.rs", "main": "./index.js", diff --git a/rust-toolchain b/rust-toolchain index 9f3b7185408..5e0ffb6e6a7 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2021-09-30 \ No newline at end of file +nightly-2021-11-08 \ No newline at end of file diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index bd72bdebce5..9b26188a3f4 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -6,7 +6,7 @@ license = "Apache-2.0 AND MIT" name = "wasm" publish = false repository = "https://github.com/swc-project/swc.git" -version = "1.2.107" +version = "1.2.108" [lib] crate-type = ["cdylib"]