Skip to content

Commit 2ed934d

Browse files
authored
fix(swc_common): Fix build (#10544)
1 parent 3d68d06 commit 2ed934d

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

.changeset/famous-trainers-run.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
swc_core: patch
3+
swc_common: patch
4+
---
5+
6+
fix(swc_common): Fix build

crates/swc_common/src/syntax_pos.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
#[cfg(not(feature = "parking_lot"))]
2-
use std::sync::Mutex;
31
use std::{
42
borrow::Cow,
53
cmp, fmt,
64
hash::{Hash, Hasher},
75
ops::{Add, Sub},
86
path::PathBuf,
9-
sync::atomic::AtomicU32,
7+
sync::{atomic::AtomicU32, Mutex},
108
};
119

12-
#[cfg(feature = "parking_lot")]
13-
use parking_lot::Mutex;
1410
use serde::{Deserialize, Serialize};
1511
use url::Url;
1612

@@ -130,8 +126,8 @@ impl Globals {
130126
/// Do not use this unless you know what you are doing.
131127
pub fn clone_data(&self) -> Self {
132128
Globals {
133-
hygiene_data: Mutex::new(self.hygiene_data.lock().clone()),
134-
marks: Mutex::new(self.marks.lock().clone()),
129+
hygiene_data: Mutex::new(self.hygiene_data.lock().unwrap().clone()),
130+
marks: Mutex::new(self.marks.lock().unwrap().clone()),
135131
dummy_cnt: AtomicU32::new(self.dummy_cnt.load(std::sync::atomic::Ordering::SeqCst)),
136132
}
137133
}

crates/swc_common/src/syntax_pos/hygiene.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,6 @@ impl HygieneData {
293293

294294
fn with<T, F: FnOnce(&mut HygieneData) -> T>(f: F) -> T {
295295
GLOBALS.with(|globals| {
296-
#[cfg(feature = "parking_lot")]
297-
return f(&mut globals.hygiene_data.lock());
298-
299-
#[cfg(not(feature = "parking_lot"))]
300296
return f(&mut globals.hygiene_data.lock().unwrap());
301297
})
302298
}
@@ -306,10 +302,6 @@ impl HygieneData {
306302
#[allow(unused)]
307303
pub(crate) fn with_marks<T, F: FnOnce(&mut Vec<MarkData>) -> T>(f: F) -> T {
308304
GLOBALS.with(|globals| {
309-
#[cfg(feature = "parking_lot")]
310-
return f(&mut globals.marks.lock());
311-
312-
#[cfg(not(feature = "parking_lot"))]
313305
return f(&mut globals.marks.lock().unwrap());
314306
})
315307
}

0 commit comments

Comments
 (0)