Skip to content

Commit 00584c6

Browse files
committed
Apply code review feedback from PR RustPython#7301
- dict version: Relaxed → Acquire/Release ordering - range iterator: deduplicate fast_next/next_fast
1 parent e630f4a commit 00584c6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

crates/vm/src/dict_inner.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ use crate::{
1919
use alloc::fmt;
2020
use core::mem::size_of;
2121
use core::ops::ControlFlow;
22-
use core::sync::atomic::{AtomicU64, Ordering::Relaxed};
22+
use core::sync::atomic::{
23+
AtomicU64,
24+
Ordering::{Acquire, Release},
25+
};
2326
use num_traits::ToPrimitive;
2427

2528
// HashIndex is intended to be same size with hash::PyHash
@@ -261,12 +264,12 @@ type PopInnerResult<T> = ControlFlow<Option<DictEntry<T>>>;
261264
impl<T: Clone> Dict<T> {
262265
/// Monotonically increasing version counter for mutation tracking.
263266
pub fn version(&self) -> u64 {
264-
self.version.load(Relaxed)
267+
self.version.load(Acquire)
265268
}
266269

267270
/// Bump the version counter after any mutation.
268271
fn bump_version(&self) {
269-
self.version.fetch_add(1, Relaxed);
272+
self.version.fetch_add(1, Release);
270273
}
271274

272275
fn read(&self) -> PyRwLockReadGuard<'_, DictInner<T>> {

0 commit comments

Comments
 (0)