Skip to content

Commit

Permalink
build: Update rustc to nightly-2024-10-07 (#9624)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 authored Oct 8, 2024
1 parent 4b0d043 commit 6a3b0fc
Show file tree
Hide file tree
Showing 100 changed files with 287 additions and 297 deletions.
40 changes: 40 additions & 0 deletions .changeset/three-ravens-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
better_scoped_tls: patch
jsdoc: patch
swc: patch
swc_allocator: patch
swc_bundler: patch
swc_common: patch
swc_config: patch
swc_css_codegen: patch
swc_css_parser: patch
swc_ecma_ast: patch
swc_ecma_codegen: patch
swc_ecma_compat_bugfixes: patch
swc_ecma_compat_es2015: patch
swc_ecma_compat_es2022: patch
swc_ecma_lints: patch
swc_ecma_minifier: patch
swc_ecma_parser: patch
swc_ecma_preset_env: patch
swc_ecma_transforms_base: patch
swc_ecma_transforms_classes: patch
swc_ecma_transforms_optimization: patch
swc_ecma_transforms_proposal: patch
swc_ecma_transforms_react: patch
swc_ecma_transforms_testing: patch
swc_ecma_transforms_typescript: patch
swc_ecma_usage_analyzer: patch
swc_ecma_utils: patch
swc_ecma_visit: patch
swc_fast_graph: patch
swc_html_codegen: patch
swc_html_parser: patch
swc_macros_common: patch
swc_plugin: patch
swc_typescript: patch
swc_xml_codegen: patch
testing: patch
---

build: Update `rustc` to `nightly-2024-10-07`
1 change: 0 additions & 1 deletion crates/better_scoped_tls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ mod tests {
#[test]
#[should_panic = "You should perform this operation in the closure passed to `set` of \
better_scoped_tls::tests::TESTTLS"]

fn panic_on_with() {
TESTTLS.with(|s| {
println!("S: {}", s);
Expand Down
2 changes: 1 addition & 1 deletion crates/jsdoc/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl_slice!(Range);
impl_slice!(RangeFrom);
impl_slice!(RangeTo);

impl<'i> From<Input<'i>> for Text {
impl From<Input<'_>> for Text {
fn from(i: Input) -> Self {
Self {
span: Span::new(i.start, i.end),
Expand Down
1 change: 0 additions & 1 deletion crates/swc/benches/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ fn base_tr_fixer(b: &mut Bencher) {
// }

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

Expand Down
1 change: 0 additions & 1 deletion crates/swc/src/dropped_comments_preserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWit
/// This transformer shifts orphaned comments to the next closest known span
/// while making a best-effort to preserve the "general orientation" of
/// comments.
pub fn dropped_comments_preserver(
comments: Option<SingleThreadedComments>,
) -> impl Fold + VisitMut {
Expand Down
1 change: 1 addition & 0 deletions crates/swc/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use swc_ecma_transforms::pass::noop;
use swc_ecma_visit::{noop_fold_type, Fold};

/// A tuple represents a plugin.
///
/// First element is a resolvable name to the plugin, second is a JSON object
/// that represents configuration option for those plugin.
/// Type of plugin's configuration is up to each plugin - swc/core does not have
Expand Down
1 change: 0 additions & 1 deletion crates/swc_allocator/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use crate::{boxed::Box, FastAlloc};
/// Faster version of [`std::vec::Vec`].
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]

pub struct Vec<T>(std::vec::Vec<T, FastAlloc>);

impl<T> Vec<T> {
Expand Down
21 changes: 9 additions & 12 deletions crates/swc_bundler/src/bundler/chunk/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ where
match s {
ExportSpecifier::Namespace(_) => {}
ExportSpecifier::Default(_) => {}
ExportSpecifier::Named(named) => match &named.exported {
Some(exported) => {
ExportSpecifier::Named(named) => {
if let Some(exported) = &named.exported {
let exported = match exported {
ModuleExportName::Ident(ident) => ident,
ModuleExportName::Str(..) => {
Expand Down Expand Up @@ -290,8 +290,7 @@ where
}
}
}
None => {}
},
}
}
}
}
Expand Down Expand Up @@ -609,8 +608,8 @@ where
// Imports are easy to handle.
for s in &import.specifiers {
match s {
ImportSpecifier::Named(s) => match &s.imported {
Some(imported) => {
ImportSpecifier::Named(s) => {
if let Some(imported) = &s.imported {
let imported = match imported {
ModuleExportName::Ident(ident) => ident,
ModuleExportName::Str(..) => {
Expand All @@ -627,8 +626,7 @@ where
),
);
}
None => {}
},
}
ImportSpecifier::Default(s) => {
new.push(
Ident::new(
Expand Down Expand Up @@ -1259,8 +1257,8 @@ where

for specifier in &import.specifiers {
match specifier {
ImportSpecifier::Named(named) => match &named.imported {
Some(imported) => {
ImportSpecifier::Named(named) => {
if let Some(imported) = &named.imported {
let imporeted_ident = match imported {
ModuleExportName::Ident(ident) => ident,
ModuleExportName::Str(..) => {
Expand All @@ -1279,8 +1277,7 @@ where
));
continue;
}
None => {}
},
}
ImportSpecifier::Default(default) => {
if let Some((src, _)) = info
.imports
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_bundler/src/bundler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ where
}

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

///
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_bundler/src/bundler/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Resolve for Resolver {
}
}

impl<'a> Tester<'a> {
impl Tester<'_> {
pub fn module(&self, name: &str) -> TransformedModule {
self.bundler
.scope
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_bundler/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl From<Ident> for Id {
}
}

impl<'a> From<&'a Ident> for Id {
impl From<&Ident> for Id {
fn from(i: &Ident) -> Self {
Id(i.sym.clone(), i.ctxt)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_bundler/src/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl<T: ?Sized + Load> Load for Box<T> {
}
}

impl<'a, T: ?Sized + Load> Load for &'a T {
impl<T: ?Sized + Load> Load for &T {
fn load(&self, file: &FileName) -> Result<ModuleData, Error> {
(**self).load(file)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_bundler/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn load_url(url: Url) -> Result<String, Error> {

write(&cache_path, &content)?;

return Ok(String::from_utf8_lossy(&bytes).to_string());
Ok(String::from_utf8_lossy(&bytes).to_string())
}

impl Load for Loader {
Expand Down
4 changes: 2 additions & 2 deletions crates/swc_common/src/eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ swc_allocator::nightly_only!(
}
);

impl<'a, N> EqIgnoreSpan for &'a N
impl<N> EqIgnoreSpan for &N
where
N: EqIgnoreSpan,
{
Expand All @@ -220,7 +220,7 @@ where
}
}

impl<'a, N> TypeEq for &'a N
impl<N> TypeEq for &N
where
N: TypeEq,
{
Expand Down
8 changes: 4 additions & 4 deletions crates/swc_common/src/errors/diagnostic_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ macro_rules! forward {
};
}

impl<'a> Deref for DiagnosticBuilder<'a> {
impl Deref for DiagnosticBuilder<'_> {
type Target = Diagnostic;

fn deref(&self) -> &Diagnostic {
&self.diagnostic
}
}

impl<'a> DerefMut for DiagnosticBuilder<'a> {
impl DerefMut for DiagnosticBuilder<'_> {
fn deref_mut(&mut self) -> &mut Diagnostic {
&mut self.diagnostic
}
Expand Down Expand Up @@ -325,15 +325,15 @@ impl<'a> DiagnosticBuilder<'a> {
}
}

impl<'a> Debug for DiagnosticBuilder<'a> {
impl Debug for DiagnosticBuilder<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.diagnostic.fmt(f)
}
}

/// Destructor bomb - a `DiagnosticBuilder` must be either emitted or canceled
/// or we emit a bug.
impl<'a> Drop for DiagnosticBuilder<'a> {
impl Drop for DiagnosticBuilder<'_> {
fn drop(&mut self) {
if !panicking() && !self.cancelled() {
let mut db = DiagnosticBuilder::new(
Expand Down
6 changes: 3 additions & 3 deletions crates/swc_common/src/errors/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,7 @@ impl Destination {
}
}

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

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

impl<'a> Drop for WritableDst<'a> {
impl Drop for WritableDst<'_> {
fn drop(&mut self) {
#[cfg(feature = "tty-emitter")]
if let WritableDst::Buffered(ref mut dst, ref mut buf) = self {
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_common/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl<'a> From<&'a SourceFile> for StringInput<'a> {
}
}

impl<'a> Input for StringInput<'a> {
impl Input for StringInput<'_> {
#[inline]
fn cur(&mut self) -> Option<char> {
self.iter.clone().next()
Expand Down
5 changes: 3 additions & 2 deletions crates/swc_common/src/plugin/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ use std::env;

use crate::collections::AHashMap;

/// Indexable key to the metadata context for a transform plugin, avoiding
/// serialization & allocation to the host by using incremental number.
/// Indexable key to the metadata context for a transform plugin.
///
/// Avoiding serialization & allocation to the host by using incremental number.
/// TransformPluginMetadataContext does not implement Index trait, instead
/// host does manual matching to corresponding value.
#[derive(Copy, Clone)]
Expand Down
3 changes: 3 additions & 0 deletions crates/swc_common/src/plugin/serialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use rkyv::Deserialize;
#[cfg_attr(feature = "__plugin", archive(check_bytes))]
#[cfg_attr(feature = "__plugin", archive_attr(repr(u32)))]
/// Enum for possible errors while running transform via plugin.
///
/// This error indicates internal operation failure either in plugin_runner
/// or plugin_macro. Plugin's transform fn itself does not allow to return
/// error - instead it should use provided `handler` to emit corresponding error
Expand All @@ -31,6 +32,8 @@ pub enum PluginError {
Serialize(String),
}

/// A wrapper type for the internal representation of serialized data.
///
/// Wraps internal representation of serialized data for exchanging data between
/// plugin to the host. Consumers should not rely on specific details of byte
/// format struct contains: it is strict implementation detail which can
Expand Down
4 changes: 2 additions & 2 deletions crates/swc_common/src/pos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait Spanned {
}
}

impl<'a, T> Spanned for Cow<'a, T>
impl<T> Spanned for Cow<'_, T>
where
T: Spanned + Clone,
{
Expand Down Expand Up @@ -145,7 +145,7 @@ where
}
}

impl<'a, S> Spanned for &'a S
impl<S> Spanned for &S
where
S: ?Sized + Spanned,
{
Expand Down
19 changes: 11 additions & 8 deletions crates/swc_common/src/source_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! The SourceMap tracks all the source code used within a single crate, mapping
//! from integer byte positions to the original source code location. Each bit
//! of source parsed during crate parsing (typically files, in-memory strings,
//! or various bits of macro expansion) cover a continuous range of bytes in the
//! SourceMap and are represented by SourceFiles. Byte positions are stored in
//! `spans` and used pervasively in the compiler. They are absolute positions
//! within the SourceMap, which upon request can be converted to line and column
//! information, source code snippets, etc.
//! The SourceMap tracks all the source code used within a single crate.
//!
//! The mapping from integer byte positions to the original source code location
//! is stored in `spans`.
//!
//! Each bit of source parsed during crate parsing (typically files, in-memory
//! strings, or various bits of macro expansion) cover a continuous range of
//! bytes in the SourceMap and are represented by SourceFiles. Byte positions
//! are stored in `spans` and used pervasively in the compiler. They are
//! absolute positions within the SourceMap, which upon request can be converted
//! to line and column information, source code snippets, etc.
use std::{
cmp, env, fs,
hash::Hash,
Expand Down
9 changes: 7 additions & 2 deletions crates/swc_common/src/syntax_pos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ use crate::{rustc_data_structures::stable_hasher::StableHasher, sync::Lrc};
mod analyze_source_file;
pub mod hygiene;

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

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

/// A struct to represent lines of a source file.
///
/// Note: This struct intentionally does not implement rkyv's archieve
/// to avoid redundant data copy (https://github.com/swc-project/swc/issues/5471)
/// source_map_proxy constructs plugin-side Loc instead with shared SourceFile
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_config/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Serialize for IsModule {

struct IsModuleVisitor;

impl<'de> Visitor<'de> for IsModuleVisitor {
impl Visitor<'_> for IsModuleVisitor {
type Value = IsModule;

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

0 comments on commit 6a3b0fc

Please sign in to comment.