diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2024-03-19 14:57:19 +0100 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2024-03-19 15:27:11 +0100 |
| commit | bf3debe9d776a6eeda48e4c063ab6798d066fc4e (patch) | |
| tree | b0f6c1043f524a66890716dbb2348bed153d39de /library/proc_macro/src/bridge | |
| parent | 5e4cc6f69475320b6d917ff4a54a063401d17f5b (diff) | |
| download | rust-bf3debe9d776a6eeda48e4c063ab6798d066fc4e.tar.gz rust-bf3debe9d776a6eeda48e4c063ab6798d066fc4e.zip | |
SeqCst->Relaxed for proc_macro bridge counter.
Relaxed is enough here.
Diffstat (limited to 'library/proc_macro/src/bridge')
| -rw-r--r-- | library/proc_macro/src/bridge/handle.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/proc_macro/src/bridge/handle.rs b/library/proc_macro/src/bridge/handle.rs index 894acae217e..8c53bb609f6 100644 --- a/library/proc_macro/src/bridge/handle.rs +++ b/library/proc_macro/src/bridge/handle.rs @@ -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 |
