Skip to content

Commit b20a393

Browse files
committed
Replace deprecated spin_loop_hint.
sled requires Rust 1.62+ and `spin_loop` is availabe starting in 1.42.
1 parent 005c023 commit b20a393

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

Diff for: src/backoff.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/// Vendored and simplified from crossbeam-utils
22
use core::cell::Cell;
3-
use core::sync::atomic;
43

54
const SPIN_LIMIT: u32 = 6;
65

@@ -31,9 +30,7 @@ impl Backoff {
3130
#[inline]
3231
pub fn spin(&self) {
3332
for _ in 0..1 << self.step.get().min(SPIN_LIMIT) {
34-
// `hint::spin_loop` requires Rust 1.49.
35-
#[allow(deprecated)]
36-
atomic::spin_loop_hint();
33+
core::hint::spin_loop();
3734
}
3835

3936
if self.step.get() <= SPIN_LIMIT {

Diff for: src/concurrency_control.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ impl ConcurrencyControl {
6464
if self.active.fetch_or(RW_REQUIRED_BIT, SeqCst) < RW_REQUIRED_BIT {
6565
// we are the first to set this bit
6666
while self.active.load(Acquire) != RW_REQUIRED_BIT {
67-
// `hint::spin_loop` requires Rust 1.49.
68-
#[allow(deprecated)]
69-
std::sync::atomic::spin_loop_hint()
67+
std::hint::spin_loop()
7068
}
7169
self.upgrade_complete.store(true, Release);
7270
}
@@ -99,9 +97,7 @@ impl ConcurrencyControl {
9997
});
10098
self.enable();
10199
while !self.upgrade_complete.load(Acquire) {
102-
// `hint::spin_loop` requires Rust 1.49.
103-
#[allow(deprecated)]
104-
std::sync::atomic::spin_loop_hint()
100+
std::hint::spin_loop()
105101
}
106102
Protector::Write(self.rw.write())
107103
}

0 commit comments

Comments
 (0)