Skip to content

Commit

Permalink
build(cargo): Update rustc to nightly-2024-04-03 (#8821)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Apr 16, 2024
1 parent 997063d commit ca9c76b
Show file tree
Hide file tree
Showing 493 changed files with 4,170 additions and 6,659 deletions.
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Also, SWC tries to ensure that
for rust users.

MSRV of crates is currently nightly, but we will support stable rustc again in the future.
MSRV of crates is currently `1.71`.

To update all SWC crates you use, you can run `curl https://raw.githubusercontent.com/swc-project/swc/main/scripts/update-all-swc-crates.sh | bash -s`. This script will update all dependencies to the latest version and run `cargo build` to ensure that everything works.
Note that you need
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ ignore-interior-mutability = [
"swc_atoms::JsWord",
"swc_ecma_ast::Id",
]
msrv = "1.58"
msrv = "1.71"
type-complexity-threshold = 25000
1 change: 0 additions & 1 deletion crates/ast_node/src/ast_node_macro.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use swc_macros_common::prelude::*;
use syn::{
self,
parse::{Parse, ParseStream},
*,
};
Expand Down
1 change: 0 additions & 1 deletion crates/ast_node/src/enum_deserialize.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use swc_macros_common::prelude::*;
use syn::{
self,
parse::{Parse, ParseStream},
*,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/ast_node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extern crate proc_macro;

use quote::quote;
use swc_macros_common::prelude::*;
use syn::{self, visit_mut::VisitMut, *};
use syn::{visit_mut::VisitMut, *};

mod ast_node_macro;
mod enum_deserialize;
Expand Down
2 changes: 1 addition & 1 deletion crates/string_enum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ extern crate proc_macro;

use quote::quote_spanned;
use swc_macros_common::prelude::*;
use syn::{self, parse::Parse, *};
use syn::{parse::Parse, *};

/// Creates `.as_str()` and then implements `Debug` and `Display` using it.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/swc/examples/minify.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{path::Path, sync::Arc};

use anyhow::Context;
use swc::{self, config::JsMinifyOptions, try_with_handler, BoolOrDataConfig};
use swc::{config::JsMinifyOptions, try_with_handler, BoolOrDataConfig};
use swc_common::{SourceMap, GLOBALS};

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion crates/swc/examples/transform.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{path::Path, sync::Arc};

use anyhow::Context;
use swc::{self, try_with_handler};
use swc::try_with_handler;
use swc_common::{SourceMap, GLOBALS};

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion crates/swc/examples/transform_error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::sync::Arc;

use anyhow::Context;
use swc::{self, try_with_handler};
use swc::try_with_handler;
use swc_common::{errors::ColorConfig, FileName, SourceMap, GLOBALS};

fn main() {
Expand Down
17 changes: 4 additions & 13 deletions crates/swc/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,9 @@ impl Options {
}
}

#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default)]
pub enum RootMode {
#[default]
#[serde(rename = "root")]
Root,
#[serde(rename = "upward")]
Expand All @@ -793,11 +794,6 @@ pub enum RootMode {
UpwardOptional,
}

impl Default for RootMode {
fn default() -> Self {
RootMode::Root
}
}
const fn default_swcrc() -> bool {
true
}
Expand Down Expand Up @@ -1179,21 +1175,16 @@ pub struct JscOutputConfig {
pub preamble: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub enum OutputCharset {
#[default]
#[serde(rename = "utf8")]
Utf8,
#[serde(rename = "ascii")]
Ascii,
}

impl Default for OutputCharset {
fn default() -> Self {
OutputCharset::Utf8
}
}

/// `jsc.experimental` in `.swcrc`
#[derive(Debug, Default, Clone, Serialize, Deserialize, Merge)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
Expand Down
2 changes: 1 addition & 1 deletion crates/swc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ use swc_common::{
pub use swc_compiler_base::{PrintArgs, TransformOutput};
pub use swc_config::config_types::{BoolConfig, BoolOr, BoolOrDataConfig};
use swc_ecma_ast::{EsVersion, Program};
use swc_ecma_codegen::{self, Node};
use swc_ecma_codegen::Node;
use swc_ecma_loader::resolvers::{
lru::CachingResolver, node::NodeModulesResolver, tsc::TsConfigResolver,
};
Expand Down
14 changes: 6 additions & 8 deletions crates/swc/tests/fixture/issues-8xxx/8020/output/1.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { _ as _dispose } from "@swc/helpers/_/_dispose";
import { _ as _using } from "@swc/helpers/_/_using";
import { _ as _using_ctx } from "@swc/helpers/_/_using_ctx";
function baz() {
return bar;
}
try {
var _stack = [];
var foo = _using(_stack, null);
var bar = 1;
var _usingCtx = _using_ctx();
var foo = _usingCtx.u(null);
const bar = 1;
console.log(baz());
} catch (_) {
var _error = _;
var _hasError = true;
_usingCtx.e = _;
} finally{
_dispose(_stack, _error, _hasError);
_usingCtx.d();
}
12 changes: 5 additions & 7 deletions crates/swc/tests/fixture/issues-8xxx/8629/output/1.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { _ as _dispose } from "@swc/helpers/_/_dispose";
import { _ as _using } from "@swc/helpers/_/_using";
import { _ as _using_ctx } from "@swc/helpers/_/_using_ctx";
var _Disposable;
try {
var _stack = [];
var _usingCtx = _using_ctx();
var _computedKey;
_computedKey = Symbol.dispose;
class Disposable {
Expand All @@ -11,12 +10,11 @@ try {
}
}
_Disposable = Disposable;
var _disposable = _using(_stack, new Disposable());
var _disposable = _usingCtx.u(new Disposable());
console.log('ok');
} catch (_) {
var _error = _;
var _hasError = true;
_usingCtx.e = _;
} finally{
_dispose(_stack, _error, _hasError);
_usingCtx.d();
}
export { _Disposable as Disposable };
12 changes: 5 additions & 7 deletions crates/swc/tests/fixture/issues-8xxx/8629/output/2.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { _ as _dispose } from "@swc/helpers/_/_dispose";
import { _ as _using } from "@swc/helpers/_/_using";
import { _ as _using_ctx } from "@swc/helpers/_/_using_ctx";
var _Disposable;
try {
var _stack = [];
var _usingCtx = _using_ctx();
var Disposable = 1334;
_Disposable = Disposable;
var _disposable = _using(_stack, new Disposable());
var _disposable = _usingCtx.u(new Disposable());
console.log('ok');
} catch (_) {
var _error = _;
var _hasError = true;
_usingCtx.e = _;
} finally{
_dispose(_stack, _error, _hasError);
_usingCtx.d();
}
export { _Disposable as Disposable };
28 changes: 12 additions & 16 deletions crates/swc/tests/fixture/issues-8xxx/8774/output/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { _ as _dispose } from "@swc/helpers/_/_dispose";
import { _ as _using } from "@swc/helpers/_/_using";
import { _ as _using_ctx } from "@swc/helpers/_/_using_ctx";
const logClean = function() {
return {
[Symbol.dispose] () {
Expand All @@ -12,42 +11,39 @@ const logClean = function() {
};
async function foo() {
try {
var _stack = [];
var a = _using(_stack, logClean());
var b = _using(_stack, logClean(), true);
var _usingCtx = _using_ctx();
const a = _usingCtx.u(logClean());
const b = _usingCtx.a(logClean());
for (const a of [
logClean(),
logClean()
]){
try {
var _stack1 = [];
var _usingCtx1 = _using_ctx();
{}
} catch (_) {
var _error = _;
var _hasError = true;
_usingCtx1.e = _;
} finally{
_dispose(_stack1, _error, _hasError);
_usingCtx1.d();
}
}
for (const a of [
logClean(),
logClean()
]){
try {
var _stack2 = [];
var _usingCtx2 = _using_ctx();
{}
} catch (_) {
var _error1 = _;
var _hasError1 = true;
_usingCtx2.e = _;
} finally{
_dispose(_stack2, _error1, _hasError1);
_usingCtx2.d();
}
}
} catch (_) {
var _error2 = _;
var _hasError2 = true;
_usingCtx.e = _;
} finally{
await _dispose(_stack, _error2, _hasError2);
await _usingCtx.d();
}
}
foo();
2 changes: 1 addition & 1 deletion crates/swc/tests/projects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use swc_common::{
BytePos, FileName, Globals, SourceMap, GLOBALS,
};
use swc_compiler_base::PrintArgs;
use swc_ecma_ast::{EsVersion, *};
use swc_ecma_ast::*;
use swc_ecma_minifier::option::MangleOptions;
use swc_ecma_parser::{EsConfig, Syntax, TsConfig};
use swc_ecma_transforms::{
Expand Down
Loading

0 comments on commit ca9c76b

Please sign in to comment.