From b20a393f2af89875b68b25d358d034fcd6571098 Mon Sep 17 00:00:00 2001 From: Taras Tsugrii Date: Sun, 3 Sep 2023 18:56:59 -0700 Subject: [PATCH] Replace deprecated spin_loop_hint. sled requires Rust 1.62+ and `spin_loop` is availabe starting in 1.42. --- src/backoff.rs | 5 +---- src/concurrency_control.rs | 8 ++------ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/backoff.rs b/src/backoff.rs index 46a65d7f4..39126bd82 100644 --- a/src/backoff.rs +++ b/src/backoff.rs @@ -1,6 +1,5 @@ /// Vendored and simplified from crossbeam-utils use core::cell::Cell; -use core::sync::atomic; const SPIN_LIMIT: u32 = 6; @@ -31,9 +30,7 @@ impl Backoff { #[inline] pub fn spin(&self) { for _ in 0..1 << self.step.get().min(SPIN_LIMIT) { - // `hint::spin_loop` requires Rust 1.49. - #[allow(deprecated)] - atomic::spin_loop_hint(); + core::hint::spin_loop(); } if self.step.get() <= SPIN_LIMIT { diff --git a/src/concurrency_control.rs b/src/concurrency_control.rs index df2f0f43a..9ce322863 100644 --- a/src/concurrency_control.rs +++ b/src/concurrency_control.rs @@ -64,9 +64,7 @@ impl ConcurrencyControl { if self.active.fetch_or(RW_REQUIRED_BIT, SeqCst) < RW_REQUIRED_BIT { // we are the first to set this bit while self.active.load(Acquire) != RW_REQUIRED_BIT { - // `hint::spin_loop` requires Rust 1.49. - #[allow(deprecated)] - std::sync::atomic::spin_loop_hint() + std::hint::spin_loop() } self.upgrade_complete.store(true, Release); } @@ -99,9 +97,7 @@ impl ConcurrencyControl { }); self.enable(); while !self.upgrade_complete.load(Acquire) { - // `hint::spin_loop` requires Rust 1.49. - #[allow(deprecated)] - std::sync::atomic::spin_loop_hint() + std::hint::spin_loop() } Protector::Write(self.rw.write()) }