SeqCst->Relaxed for proc_macro bridge counter.
Relaxed is enough here.
This commit is contained in:
parent
5e4cc6f694
commit
bf3debe9d7
1 changed files with 2 additions and 2 deletions
|
@ -21,7 +21,7 @@ impl<T> OwnedStore<T> {
|
|||
pub(super) fn new(counter: &'static AtomicU32) -> Self {
|
||||
// Ensure the handle counter isn't 0, which would panic later,
|
||||
// when `NonZero::new` (aka `Handle::new`) is called in `alloc`.
|
||||
assert_ne!(counter.load(Ordering::SeqCst), 0);
|
||||
assert_ne!(counter.load(Ordering::Relaxed), 0);
|
||||
|
||||
OwnedStore { counter, data: BTreeMap::new() }
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ impl<T> OwnedStore<T> {
|
|||
|
||||
impl<T> OwnedStore<T> {
|
||||
pub(super) fn alloc(&mut self, x: T) -> Handle {
|
||||
let counter = self.counter.fetch_add(1, Ordering::SeqCst);
|
||||
let counter = self.counter.fetch_add(1, Ordering::Relaxed);
|
||||
let handle = Handle::new(counter).expect("`proc_macro` handle counter overflowed");
|
||||
assert!(self.data.insert(handle, x).is_none());
|
||||
handle
|
||||
|
|
Loading…
Add table
Reference in a new issue