Skip to content

Commit 6a3b0fc

Browse files
authored
build: Update rustc to nightly-2024-10-07 (#9624)
1 parent 4b0d043 commit 6a3b0fc

File tree

100 files changed

+287
-297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+287
-297
lines changed

.changeset/three-ravens-joke.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
better_scoped_tls: patch
3+
jsdoc: patch
4+
swc: patch
5+
swc_allocator: patch
6+
swc_bundler: patch
7+
swc_common: patch
8+
swc_config: patch
9+
swc_css_codegen: patch
10+
swc_css_parser: patch
11+
swc_ecma_ast: patch
12+
swc_ecma_codegen: patch
13+
swc_ecma_compat_bugfixes: patch
14+
swc_ecma_compat_es2015: patch
15+
swc_ecma_compat_es2022: patch
16+
swc_ecma_lints: patch
17+
swc_ecma_minifier: patch
18+
swc_ecma_parser: patch
19+
swc_ecma_preset_env: patch
20+
swc_ecma_transforms_base: patch
21+
swc_ecma_transforms_classes: patch
22+
swc_ecma_transforms_optimization: patch
23+
swc_ecma_transforms_proposal: patch
24+
swc_ecma_transforms_react: patch
25+
swc_ecma_transforms_testing: patch
26+
swc_ecma_transforms_typescript: patch
27+
swc_ecma_usage_analyzer: patch
28+
swc_ecma_utils: patch
29+
swc_ecma_visit: patch
30+
swc_fast_graph: patch
31+
swc_html_codegen: patch
32+
swc_html_parser: patch
33+
swc_macros_common: patch
34+
swc_plugin: patch
35+
swc_typescript: patch
36+
swc_xml_codegen: patch
37+
testing: patch
38+
---
39+
40+
build: Update `rustc` to `nightly-2024-10-07`

crates/better_scoped_tls/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ mod tests {
9292
#[test]
9393
#[should_panic = "You should perform this operation in the closure passed to `set` of \
9494
better_scoped_tls::tests::TESTTLS"]
95-
9695
fn panic_on_with() {
9796
TESTTLS.with(|s| {
9897
println!("S: {}", s);

crates/jsdoc/src/input.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl_slice!(Range);
5454
impl_slice!(RangeFrom);
5555
impl_slice!(RangeTo);
5656

57-
impl<'i> From<Input<'i>> for Text {
57+
impl From<Input<'_>> for Text {
5858
fn from(i: Input) -> Self {
5959
Self {
6060
span: Span::new(i.start, i.end),

crates/swc/benches/typescript.rs

-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ fn base_tr_fixer(b: &mut Bencher) {
101101
// }
102102

103103
/// This benchmark exists to know exact execution time of each pass.
104-
105104
fn bench_codegen(b: &mut Bencher, _target: EsVersion) {
106105
let c = mk();
107106

crates/swc/src/dropped_comments_preserver.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWit
1616
/// This transformer shifts orphaned comments to the next closest known span
1717
/// while making a best-effort to preserve the "general orientation" of
1818
/// comments.
19-
2019
pub fn dropped_comments_preserver(
2120
comments: Option<SingleThreadedComments>,
2221
) -> impl Fold + VisitMut {

crates/swc/src/plugin.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use swc_ecma_transforms::pass::noop;
1414
use swc_ecma_visit::{noop_fold_type, Fold};
1515

1616
/// A tuple represents a plugin.
17+
///
1718
/// First element is a resolvable name to the plugin, second is a JSON object
1819
/// that represents configuration option for those plugin.
1920
/// Type of plugin's configuration is up to each plugin - swc/core does not have

crates/swc_allocator/src/vec/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use crate::{boxed::Box, FastAlloc};
1515
/// Faster version of [`std::vec::Vec`].
1616
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1717
#[repr(transparent)]
18-
1918
pub struct Vec<T>(std::vec::Vec<T, FastAlloc>);
2019

2120
impl<T> Vec<T> {

crates/swc_bundler/src/bundler/chunk/merge.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ where
259259
match s {
260260
ExportSpecifier::Namespace(_) => {}
261261
ExportSpecifier::Default(_) => {}
262-
ExportSpecifier::Named(named) => match &named.exported {
263-
Some(exported) => {
262+
ExportSpecifier::Named(named) => {
263+
if let Some(exported) = &named.exported {
264264
let exported = match exported {
265265
ModuleExportName::Ident(ident) => ident,
266266
ModuleExportName::Str(..) => {
@@ -290,8 +290,7 @@ where
290290
}
291291
}
292292
}
293-
None => {}
294-
},
293+
}
295294
}
296295
}
297296
}
@@ -609,8 +608,8 @@ where
609608
// Imports are easy to handle.
610609
for s in &import.specifiers {
611610
match s {
612-
ImportSpecifier::Named(s) => match &s.imported {
613-
Some(imported) => {
611+
ImportSpecifier::Named(s) => {
612+
if let Some(imported) = &s.imported {
614613
let imported = match imported {
615614
ModuleExportName::Ident(ident) => ident,
616615
ModuleExportName::Str(..) => {
@@ -627,8 +626,7 @@ where
627626
),
628627
);
629628
}
630-
None => {}
631-
},
629+
}
632630
ImportSpecifier::Default(s) => {
633631
new.push(
634632
Ident::new(
@@ -1259,8 +1257,8 @@ where
12591257

12601258
for specifier in &import.specifiers {
12611259
match specifier {
1262-
ImportSpecifier::Named(named) => match &named.imported {
1263-
Some(imported) => {
1260+
ImportSpecifier::Named(named) => {
1261+
if let Some(imported) = &named.imported {
12641262
let imporeted_ident = match imported {
12651263
ModuleExportName::Ident(ident) => ident,
12661264
ModuleExportName::Str(..) => {
@@ -1279,8 +1277,7 @@ where
12791277
));
12801278
continue;
12811279
}
1282-
None => {}
1283-
},
1280+
}
12841281
ImportSpecifier::Default(default) => {
12851282
if let Some((src, _)) = info
12861283
.imports

crates/swc_bundler/src/bundler/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ where
141141
}
142142

143143
pub(crate) fn is_external(&self, src: &JsWord) -> bool {
144-
return self.config.external_modules.iter().any(|v| v == src);
144+
self.config.external_modules.iter().any(|v| v == src)
145145
}
146146

147147
///

crates/swc_bundler/src/bundler/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl Resolve for Resolver {
6969
}
7070
}
7171

72-
impl<'a> Tester<'a> {
72+
impl Tester<'_> {
7373
pub fn module(&self, name: &str) -> TransformedModule {
7474
self.bundler
7575
.scope

crates/swc_bundler/src/id.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl From<Ident> for Id {
9999
}
100100
}
101101

102-
impl<'a> From<&'a Ident> for Id {
102+
impl From<&Ident> for Id {
103103
fn from(i: &Ident) -> Self {
104104
Id(i.sym.clone(), i.ctxt)
105105
}

crates/swc_bundler/src/load.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<T: ?Sized + Load> Load for Box<T> {
4949
}
5050
}
5151

52-
impl<'a, T: ?Sized + Load> Load for &'a T {
52+
impl<T: ?Sized + Load> Load for &T {
5353
fn load(&self, file: &FileName) -> Result<ModuleData, Error> {
5454
(**self).load(file)
5555
}

crates/swc_bundler/tests/common/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn load_url(url: Url) -> Result<String, Error> {
8484

8585
write(&cache_path, &content)?;
8686

87-
return Ok(String::from_utf8_lossy(&bytes).to_string());
87+
Ok(String::from_utf8_lossy(&bytes).to_string())
8888
}
8989

9090
impl Load for Loader {

crates/swc_common/src/eq.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ swc_allocator::nightly_only!(
210210
}
211211
);
212212

213-
impl<'a, N> EqIgnoreSpan for &'a N
213+
impl<N> EqIgnoreSpan for &N
214214
where
215215
N: EqIgnoreSpan,
216216
{
@@ -220,7 +220,7 @@ where
220220
}
221221
}
222222

223-
impl<'a, N> TypeEq for &'a N
223+
impl<N> TypeEq for &N
224224
where
225225
N: TypeEq,
226226
{

crates/swc_common/src/errors/diagnostic_builder.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ macro_rules! forward {
7878
};
7979
}
8080

81-
impl<'a> Deref for DiagnosticBuilder<'a> {
81+
impl Deref for DiagnosticBuilder<'_> {
8282
type Target = Diagnostic;
8383

8484
fn deref(&self) -> &Diagnostic {
8585
&self.diagnostic
8686
}
8787
}
8888

89-
impl<'a> DerefMut for DiagnosticBuilder<'a> {
89+
impl DerefMut for DiagnosticBuilder<'_> {
9090
fn deref_mut(&mut self) -> &mut Diagnostic {
9191
&mut self.diagnostic
9292
}
@@ -325,15 +325,15 @@ impl<'a> DiagnosticBuilder<'a> {
325325
}
326326
}
327327

328-
impl<'a> Debug for DiagnosticBuilder<'a> {
328+
impl Debug for DiagnosticBuilder<'_> {
329329
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
330330
self.diagnostic.fmt(f)
331331
}
332332
}
333333

334334
/// Destructor bomb - a `DiagnosticBuilder` must be either emitted or canceled
335335
/// or we emit a bug.
336-
impl<'a> Drop for DiagnosticBuilder<'a> {
336+
impl Drop for DiagnosticBuilder<'_> {
337337
fn drop(&mut self) {
338338
if !panicking() && !self.cancelled() {
339339
let mut db = DiagnosticBuilder::new(

crates/swc_common/src/errors/emitter.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ impl Destination {
15481548
}
15491549
}
15501550

1551-
impl<'a> WritableDst<'a> {
1551+
impl WritableDst<'_> {
15521552
#[cfg(feature = "tty-emitter")]
15531553
fn apply_style(&mut self, lvl: Level, style: Style) -> io::Result<()> {
15541554
let mut spec = ColorSpec::new();
@@ -1616,7 +1616,7 @@ impl<'a> WritableDst<'a> {
16161616
}
16171617
}
16181618

1619-
impl<'a> Write for WritableDst<'a> {
1619+
impl Write for WritableDst<'_> {
16201620
fn write(&mut self, bytes: &[u8]) -> io::Result<usize> {
16211621
match *self {
16221622
#[cfg(feature = "tty-emitter")]
@@ -1638,7 +1638,7 @@ impl<'a> Write for WritableDst<'a> {
16381638
}
16391639
}
16401640

1641-
impl<'a> Drop for WritableDst<'a> {
1641+
impl Drop for WritableDst<'_> {
16421642
fn drop(&mut self) {
16431643
#[cfg(feature = "tty-emitter")]
16441644
if let WritableDst::Buffered(ref mut dst, ref mut buf) = self {

crates/swc_common/src/input.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'a> From<&'a SourceFile> for StringInput<'a> {
7272
}
7373
}
7474

75-
impl<'a> Input for StringInput<'a> {
75+
impl Input for StringInput<'_> {
7676
#[inline]
7777
fn cur(&mut self) -> Option<char> {
7878
self.iter.clone().next()

crates/swc_common/src/plugin/metadata.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ use std::env;
22

33
use crate::collections::AHashMap;
44

5-
/// Indexable key to the metadata context for a transform plugin, avoiding
6-
/// serialization & allocation to the host by using incremental number.
5+
/// Indexable key to the metadata context for a transform plugin.
6+
///
7+
/// Avoiding serialization & allocation to the host by using incremental number.
78
/// TransformPluginMetadataContext does not implement Index trait, instead
89
/// host does manual matching to corresponding value.
910
#[derive(Copy, Clone)]

crates/swc_common/src/plugin/serialized.rs

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use rkyv::Deserialize;
1313
#[cfg_attr(feature = "__plugin", archive(check_bytes))]
1414
#[cfg_attr(feature = "__plugin", archive_attr(repr(u32)))]
1515
/// Enum for possible errors while running transform via plugin.
16+
///
1617
/// This error indicates internal operation failure either in plugin_runner
1718
/// or plugin_macro. Plugin's transform fn itself does not allow to return
1819
/// error - instead it should use provided `handler` to emit corresponding error
@@ -31,6 +32,8 @@ pub enum PluginError {
3132
Serialize(String),
3233
}
3334

35+
/// A wrapper type for the internal representation of serialized data.
36+
///
3437
/// Wraps internal representation of serialized data for exchanging data between
3538
/// plugin to the host. Consumers should not rely on specific details of byte
3639
/// format struct contains: it is strict implementation detail which can

crates/swc_common/src/pos.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub trait Spanned {
2424
}
2525
}
2626

27-
impl<'a, T> Spanned for Cow<'a, T>
27+
impl<T> Spanned for Cow<'_, T>
2828
where
2929
T: Spanned + Clone,
3030
{
@@ -145,7 +145,7 @@ where
145145
}
146146
}
147147

148-
impl<'a, S> Spanned for &'a S
148+
impl<S> Spanned for &S
149149
where
150150
S: ?Sized + Spanned,
151151
{

crates/swc_common/src/source_map.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! The SourceMap tracks all the source code used within a single crate, mapping
12-
//! from integer byte positions to the original source code location. Each bit
13-
//! of source parsed during crate parsing (typically files, in-memory strings,
14-
//! or various bits of macro expansion) cover a continuous range of bytes in the
15-
//! SourceMap and are represented by SourceFiles. Byte positions are stored in
16-
//! `spans` and used pervasively in the compiler. They are absolute positions
17-
//! within the SourceMap, which upon request can be converted to line and column
18-
//! information, source code snippets, etc.
11+
//! The SourceMap tracks all the source code used within a single crate.
12+
//!
13+
//! The mapping from integer byte positions to the original source code location
14+
//! is stored in `spans`.
15+
//!
16+
//! Each bit of source parsed during crate parsing (typically files, in-memory
17+
//! strings, or various bits of macro expansion) cover a continuous range of
18+
//! bytes in the SourceMap and are represented by SourceFiles. Byte positions
19+
//! are stored in `spans` and used pervasively in the compiler. They are
20+
//! absolute positions within the SourceMap, which upon request can be converted
21+
//! to line and column information, source code snippets, etc.
1922
use std::{
2023
cmp, env, fs,
2124
hash::Hash,

crates/swc_common/src/syntax_pos.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ use crate::{rustc_data_structures::stable_hasher::StableHasher, sync::Lrc};
2121
mod analyze_source_file;
2222
pub mod hygiene;
2323

24-
/// Spans represent a region of code, used for error reporting. Positions in
24+
/// Spans represent a region of code, used for error reporting.
25+
///
26+
/// Positions in
2527
/// spans are *absolute* positions from the beginning of the `source_map`, not
2628
/// positions relative to `SourceFile`s. Methods on the `SourceMap` can be used
2729
/// to relate spans back to the original source.
@@ -1154,7 +1156,8 @@ impl Sub for CharPos {
11541156
// Loc, LocWithOpt, SourceFileAndLine, SourceFileAndBytePos
11551157
//
11561158

1157-
/// A source code location used for error reporting
1159+
/// A source code location used for error reporting.
1160+
///
11581161
/// Note: This struct intentionally does not implement rkyv's archieve
11591162
/// to avoid redundant data copy (https://github.com/swc-project/swc/issues/5471)
11601163
/// source_map_proxy constructs plugin-side Loc instead with shared SourceFile
@@ -1244,6 +1247,8 @@ pub struct LineCol {
12441247
pub col: u32,
12451248
}
12461249

1250+
/// A struct to represent lines of a source file.
1251+
///
12471252
/// Note: This struct intentionally does not implement rkyv's archieve
12481253
/// to avoid redundant data copy (https://github.com/swc-project/swc/issues/5471)
12491254
/// source_map_proxy constructs plugin-side Loc instead with shared SourceFile

crates/swc_config/src/module.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl Serialize for IsModule {
4141

4242
struct IsModuleVisitor;
4343

44-
impl<'de> Visitor<'de> for IsModuleVisitor {
44+
impl Visitor<'_> for IsModuleVisitor {
4545
type Value = IsModule;
4646

4747
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {

0 commit comments

Comments
 (0)