Skip to content

Commit 5dc441c

Browse files
committed
Ordering::Relaxed for the proc_macro detection
1 parent a2b4ff3 commit 5dc441c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/detection.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ static WORKS: AtomicUsize = AtomicUsize::new(0);
55
static INIT: Once = Once::new();
66

77
pub(crate) fn inside_proc_macro() -> bool {
8-
match WORKS.load(Ordering::SeqCst) {
8+
match WORKS.load(Ordering::Relaxed) {
99
1 => return false,
1010
2 => return true,
1111
_ => {}
@@ -16,7 +16,7 @@ pub(crate) fn inside_proc_macro() -> bool {
1616
}
1717

1818
pub(crate) fn force_fallback() {
19-
WORKS.store(1, Ordering::SeqCst);
19+
WORKS.store(1, Ordering::Relaxed);
2020
}
2121

2222
pub(crate) fn unforce_fallback() {
@@ -26,7 +26,7 @@ pub(crate) fn unforce_fallback() {
2626
#[cfg(not(no_is_available))]
2727
fn initialize() {
2828
let available = proc_macro::is_available();
29-
WORKS.store(available as usize + 1, Ordering::SeqCst);
29+
WORKS.store(available as usize + 1, Ordering::Relaxed);
3030
}
3131

3232
// Swap in a null panic hook to avoid printing "thread panicked" to stderr,
@@ -65,7 +65,7 @@ fn initialize() {
6565
panic::set_hook(null_hook);
6666

6767
let works = panic::catch_unwind(proc_macro::Span::call_site).is_ok();
68-
WORKS.store(works as usize + 1, Ordering::SeqCst);
68+
WORKS.store(works as usize + 1, Ordering::Relaxed);
6969

7070
let hopefully_null_hook = panic::take_hook();
7171
panic::set_hook(original_hook);

0 commit comments

Comments
 (0)