Skip to content

Commit

Permalink
Fix swc_common
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Feb 21, 2025
1 parent 5ec5110 commit 85a8753
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 61 deletions.
71 changes: 35 additions & 36 deletions crates/swc_common/src/eq.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::{cell::RefCell, rc::Rc, sync::Arc};

use num_bigint::BigInt;
use swc_allocator::nightly_only;

use crate::{BytePos, Span};

Expand Down Expand Up @@ -64,20 +63,20 @@ where
}
}

nightly_only!(
impl<T> EqIgnoreSpan for swc_allocator::vec::Vec<T>
where
T: EqIgnoreSpan,
{
fn eq_ignore_span(&self, other: &Self) -> bool {
self.len() == other.len()
&& self
.iter()
.zip(other.iter())
.all(|(a, b)| a.eq_ignore_span(b))
}
}
);
// nightly_only!(
// impl<T> EqIgnoreSpan for swc_allocator::vec::Vec<T>
// where
// T: EqIgnoreSpan,
// {
// fn eq_ignore_span(&self, other: &Self) -> bool {
// self.len() == other.len()
// && self
// .iter()
// .zip(other.iter())
// .all(|(a, b)| a.eq_ignore_span(b))
// }
// }
// );

/// Derive with `#[derive(TypeEq)]`.
pub trait TypeEq {
Expand Down Expand Up @@ -188,27 +187,27 @@ macro_rules! deref {

deref!(Box, Rc, Arc);

swc_allocator::nightly_only!(
impl<N> EqIgnoreSpan for swc_allocator::boxed::Box<N>
where
N: EqIgnoreSpan,
{
#[inline]
fn eq_ignore_span(&self, other: &Self) -> bool {
(**self).eq_ignore_span(&**other)
}
}

impl<N> TypeEq for swc_allocator::boxed::Box<N>
where
N: TypeEq,
{
#[inline]
fn type_eq(&self, other: &Self) -> bool {
(**self).type_eq(&**other)
}
}
);
// swc_allocator::nightly_only!(
// impl<N> EqIgnoreSpan for swc_allocator::boxed::Box<N>
// where
// N: EqIgnoreSpan,
// {
// #[inline]
// fn eq_ignore_span(&self, other: &Self) -> bool {
// (**self).eq_ignore_span(&**other)
// }
// }

// impl<N> TypeEq for swc_allocator::boxed::Box<N>
// where
// N: TypeEq,
// {
// #[inline]
// fn type_eq(&self, other: &Self) -> bool {
// (**self).type_eq(&**other)
// }
// }
// );

impl<N> EqIgnoreSpan for &N
where
Expand Down
20 changes: 10 additions & 10 deletions crates/swc_common/src/pos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ where
}
}

swc_allocator::nightly_only!(
impl<T> Spanned for swc_allocator::boxed::Box<T>
where
T: Spanned,
{
fn span(&self) -> Span {
self.as_ref().span()
}
}
);
// swc_allocator::nightly_only!(
// impl<T> Spanned for swc_allocator::boxed::Box<T>
// where
// T: Spanned,
// {
// fn span(&self) -> Span {
// self.as_ref().span()
// }
// }
// );
30 changes: 15 additions & 15 deletions crates/swc_common/src/util/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ impl Take for Span {
}
}

swc_allocator::nightly_only!(
impl<T> Take for swc_allocator::boxed::Box<T>
where
T: Take,
{
fn dummy() -> Self {
swc_allocator::boxed::Box::new(T::dummy())
}
}
// swc_allocator::nightly_only!(
// impl<T> Take for swc_allocator::boxed::Box<T>
// where
// T: Take,
// {
// fn dummy() -> Self {
// swc_allocator::boxed::Box::new(T::dummy())
// }
// }

impl<T> Take for swc_allocator::vec::Vec<T> {
fn dummy() -> Self {
Default::default()
}
}
);
// impl<T> Take for swc_allocator::vec::Vec<T> {
// fn dummy() -> Self {
// Default::default()
// }
// }
// );

0 comments on commit 85a8753

Please sign in to comment.