Skip to content

Commit bf3debe

Browse files
committed
SeqCst->Relaxed for proc_macro bridge counter.
Relaxed is enough here.
1 parent 5e4cc6f commit bf3debe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/proc_macro/src/bridge/handle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ impl<T> OwnedStore<T> {
2121
pub(super) fn new(counter: &'static AtomicU32) -> Self {
2222
// Ensure the handle counter isn't 0, which would panic later,
2323
// when `NonZero::new` (aka `Handle::new`) is called in `alloc`.
24-
assert_ne!(counter.load(Ordering::SeqCst), 0);
24+
assert_ne!(counter.load(Ordering::Relaxed), 0);
2525

2626
OwnedStore { counter, data: BTreeMap::new() }
2727
}
2828
}
2929

3030
impl<T> OwnedStore<T> {
3131
pub(super) fn alloc(&mut self, x: T) -> Handle {
32-
let counter = self.counter.fetch_add(1, Ordering::SeqCst);
32+
let counter = self.counter.fetch_add(1, Ordering::Relaxed);
3333
let handle = Handle::new(counter).expect("`proc_macro` handle counter overflowed");
3434
assert!(self.data.insert(handle, x).is_none());
3535
handle

0 commit comments

Comments
 (0)