Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(cargo): Update rustc to nightly-2023-03-20 #7170

Merged
merged 3 commits into from Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 15 additions & 6 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions clippy.toml
@@ -1,4 +1,5 @@
blacklisted-names = [
cognitive-complexity-threshold = 50
disallowed-names = [
"bool",
"char",
"str",
Expand All @@ -15,6 +16,5 @@ blacklisted-names = [
"isize",
"usize",
]
cognitive-complexity-threshold = 50
msrv = "1.58"
type-complexity-threshold = 25000
8 changes: 3 additions & 5 deletions crates/dbg-swc/src/util/minifier.rs
Expand Up @@ -7,7 +7,7 @@ use std::{
use anyhow::{bail, Context, Result};
use swc_common::{FileName, SourceMap};
use swc_ecma_ast::*;
use swc_ecma_minifier::option::{CompressOptions, MinifyOptions};
use swc_ecma_minifier::option::MinifyOptions;
use swc_ecma_transforms_base::fixer::fixer;
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};

Expand All @@ -31,9 +31,7 @@ pub fn get_minified(
None,
&MinifyOptions {
compress: if compress {
Some(CompressOptions {
..Default::default()
})
Some(Default::default())
} else {
None
},
Expand Down Expand Up @@ -70,7 +68,7 @@ pub fn get_terser_output(file: &Path, compress: bool, mangle: bool) -> Result<St
if mangle {
cmd.arg("--mangle");
}
cmd.arg("--comments false");
cmd.args(["--comments", "false"]);
cmd.arg("--");
cmd.arg(file);

Expand Down
6 changes: 2 additions & 4 deletions crates/swc/benches/typescript.rs
Expand Up @@ -11,7 +11,7 @@ use swc_common::{
errors::Handler, FileName, FilePathMapping, Mark, SourceFile, SourceMap, GLOBALS,
};
use swc_ecma_ast::{EsVersion, Program};
use swc_ecma_parser::{Syntax, TsConfig};
use swc_ecma_parser::Syntax;
use swc_ecma_transforms::{fixer, hygiene, resolver, typescript};
use swc_ecma_visit::FoldWith;

Expand Down Expand Up @@ -177,9 +177,7 @@ fn full_group(c: &mut Criterion) {
config: Config {
jsc: JscConfig {
target: Some($target),
syntax: Some(Syntax::Typescript(TsConfig {
..Default::default()
})),
syntax: Some(Syntax::Typescript(Default::default())),
..Default::default()
},
module: None,
Expand Down
58 changes: 26 additions & 32 deletions crates/swc/examples/minify.rs
@@ -1,7 +1,7 @@
use std::{path::Path, sync::Arc};

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

fn main() {
Expand All @@ -10,38 +10,32 @@ fn main() {
let c = swc::Compiler::new(cm.clone());
let output = GLOBALS
.set(&Default::default(), || {
try_with_handler(
cm.clone(),
HandlerOpts {
..Default::default()
},
|handler| {
let fm = cm
.load_file(Path::new("examples/transform-input.js"))
.expect("failed to load file");
try_with_handler(cm.clone(), Default::default(), |handler| {
let fm = cm
.load_file(Path::new("examples/transform-input.js"))
.expect("failed to load file");

c.minify(
fm,
handler,
&JsMinifyOptions {
compress: BoolOrDataConfig::from_bool(true),
mangle: BoolOrDataConfig::from_bool(true),
format: Default::default(),
ecma: Default::default(),
keep_classnames: Default::default(),
keep_fnames: Default::default(),
module: Default::default(),
safari10: Default::default(),
toplevel: Default::default(),
source_map: Default::default(),
output_path: Default::default(),
inline_sources_content: Default::default(),
emit_source_map_columns: Default::default(),
},
)
.context("failed to minify")
},
)
c.minify(
fm,
handler,
&JsMinifyOptions {
compress: BoolOrDataConfig::from_bool(true),
mangle: BoolOrDataConfig::from_bool(true),
format: Default::default(),
ecma: Default::default(),
keep_classnames: Default::default(),
keep_fnames: Default::default(),
module: Default::default(),
safari10: Default::default(),
toplevel: Default::default(),
source_map: Default::default(),
output_path: Default::default(),
inline_sources_content: Default::default(),
emit_source_map_columns: Default::default(),
},
)
.context("failed to minify")
})
})
.unwrap();

Expand Down
26 changes: 7 additions & 19 deletions crates/swc/examples/transform.rs
@@ -1,7 +1,7 @@
use std::{path::Path, sync::Arc};

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

fn main() {
Expand All @@ -10,26 +10,14 @@ fn main() {
let c = swc::Compiler::new(cm.clone());
let output = GLOBALS
.set(&Default::default(), || {
try_with_handler(
cm.clone(),
HandlerOpts {
..Default::default()
},
|handler| {
let fm = cm
.load_file(Path::new("examples/transform-input.js"))
.expect("failed to load file");
try_with_handler(cm.clone(), Default::default(), |handler| {
let fm = cm
.load_file(Path::new("examples/transform-input.js"))
.expect("failed to load file");

c.process_js_file(
fm,
handler,
&Options {
..Default::default()
},
)
c.process_js_file(fm, handler, &Default::default())
.context("failed to process file")
},
)
})
})
.unwrap();

Expand Down
12 changes: 3 additions & 9 deletions crates/swc/examples/transform_error.rs
@@ -1,7 +1,7 @@
use std::sync::Arc;

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

fn main() {
Expand All @@ -22,14 +22,8 @@ fn main() {
let fm =
cm.new_source_file(FileName::Custom("foo.js".into()), "this ?= foo".into());

c.process_js_file(
fm,
handler,
&Options {
..Default::default()
},
)
.context("failed to process file")
c.process_js_file(fm, handler, &Default::default())
.context("failed to process file")
},
)
})
Expand Down
6 changes: 2 additions & 4 deletions crates/swc/tests/exec.rs
Expand Up @@ -16,7 +16,7 @@ use swc::{
};
use swc_common::{errors::ColorConfig, SourceMap, GLOBALS};
use swc_ecma_ast::EsVersion;
use swc_ecma_parser::{EsConfig, Syntax, TsConfig};
use swc_ecma_parser::{Syntax, TsConfig};
use swc_ecma_testing::{exec_node_js, JsExecOptions};
use testing::{assert_eq, find_executable, unignore_fixture};
use tracing::{span, Level};
Expand Down Expand Up @@ -149,9 +149,7 @@ fn create_matrix(entry: &Path) -> Vec<Options> {
]
.into_iter()
.matrix(|| {
let default_es = Syntax::Es(EsConfig {
..Default::default()
});
let default_es = Syntax::Es(Default::default());

if let Some(ext) = entry.extension() {
if ext == "ts" {
Expand Down
6 changes: 2 additions & 4 deletions crates/swc/tests/projects.rs
Expand Up @@ -669,7 +669,7 @@ impl Fold for Panicking {
panic!("visited: {}", sym)
}

JSXOpeningElement { ..node }
node
}
}

Expand Down Expand Up @@ -964,9 +964,7 @@ fn issue_6009() {
config: Config {
exclude,
jsc: JscConfig {
syntax: Some(Syntax::Typescript(TsConfig {
..Default::default()
})),
syntax: Some(Syntax::Typescript(Default::default())),
..Default::default()
},
..Default::default()
Expand Down
6 changes: 2 additions & 4 deletions crates/swc/tests/rust_api.rs
Expand Up @@ -5,7 +5,7 @@ use swc::{
use swc_common::{comments::SingleThreadedComments, FileName};
use swc_ecma_ast::*;
use swc_ecma_parser::{EsConfig, Syntax, TsConfig};
use swc_ecma_transforms::{modules::common_js, pass::noop};
use swc_ecma_transforms::pass::noop;
use swc_ecma_visit::{as_folder, noop_visit_mut_type, VisitMut};

struct PanicOnVisit;
Expand Down Expand Up @@ -92,9 +92,7 @@ fn shopify_1_check_filename() {
})),
..Default::default()
},
module: Some(ModuleConfig::CommonJs(common_js::Config {
..Default::default()
})),
module: Some(ModuleConfig::CommonJs(Default::default())),
..Default::default()
},
..Default::default()
Expand Down
10 changes: 3 additions & 7 deletions crates/swc/tests/simple.rs
Expand Up @@ -4,7 +4,7 @@ use swc::{
};
use swc_common::FileName;
use swc_ecma_ast::EsVersion;
use swc_ecma_parser::{EsConfig, Syntax, TsConfig};
use swc_ecma_parser::{Syntax, TsConfig};
use testing::Tester;

fn compile(src: &str, options: Options) -> String {
Expand Down Expand Up @@ -53,9 +53,7 @@ const someValue = 'test' ?? 'default value';",
Options {
config: Config {
jsc: JscConfig {
syntax: Some(Syntax::Es(EsConfig {
..Default::default()
})),
syntax: Some(Syntax::Es(Default::default())),
..Default::default()
},
..Default::default()
Expand All @@ -73,9 +71,7 @@ fn issue_834_3() {
Options {
config: Config {
jsc: JscConfig {
syntax: Some(Syntax::Es(EsConfig {
..Default::default()
})),
syntax: Some(Syntax::Es(Default::default())),
..Default::default()
},
..Default::default()
Expand Down
4 changes: 2 additions & 2 deletions crates/swc_atoms/Cargo.toml
Expand Up @@ -22,8 +22,8 @@ rkyv-bytecheck-impl = ["__rkyv", "rkyv-latest"]
[dependencies]
bytecheck = { version = "0.6.9", optional = true }
once_cell = "1"
rkyv = { package = "rkyv", version = "=0.7.37", optional = true }
# This is to avoid cargo version selection conflict between rkyv=0.7.37 and other versions, as it is strictly pinned
rkyv = { package = "rkyv", version = "=0.7.40", optional = true }
# This is to avoid cargo version selection conflict between rkyv=0.7.40 and other versions, as it is strictly pinned
# cannot be merged.
rkyv-latest = { package = "rkyv-test", version = "=0.7.38-test.2", optional = true }
rustc-hash = "1.1.0"
Expand Down
6 changes: 2 additions & 4 deletions crates/swc_bundler/examples/bundle.rs
Expand Up @@ -30,7 +30,7 @@ use swc_ecma_loader::{
use swc_ecma_minifier::option::{
CompressOptions, ExtraOptions, MangleOptions, MinifyOptions, TopLevelOptions,
};
use swc_ecma_parser::{parse_file_as_module, EsConfig, Syntax};
use swc_ecma_parser::{parse_file_as_module, Syntax};
use swc_ecma_transforms_base::fixer::fixer;
use swc_ecma_visit::VisitMutWith;

Expand Down Expand Up @@ -233,9 +233,7 @@ impl Load for Loader {

let module = parse_file_as_module(
&fm,
Syntax::Es(EsConfig {
..Default::default()
}),
Syntax::Es(Default::default()),
EsVersion::Es2020,
None,
&mut vec![],
Expand Down
6 changes: 2 additions & 4 deletions crates/swc_bundler/examples/path.rs
Expand Up @@ -5,7 +5,7 @@ use swc_bundler::{BundleKind, Bundler, Config, Hook, Load, ModuleData, ModuleRec
use swc_common::{sync::Lrc, FileName, FilePathMapping, Globals, SourceMap, Span};
use swc_ecma_ast::KeyValueProp;
use swc_ecma_codegen::{text_writer::JsWriter, Emitter};
use swc_ecma_parser::{parse_file_as_module, EsConfig, Syntax};
use swc_ecma_parser::{parse_file_as_module, Syntax};

fn main() {
let _log = testing::init();
Expand Down Expand Up @@ -73,9 +73,7 @@ impl Load for PathLoader {

let module = parse_file_as_module(
&fm,
Syntax::Es(EsConfig {
..Default::default()
}),
Syntax::Es(Default::default()),
Default::default(),
None,
&mut vec![],
Expand Down