From 7e54f8bd910a5191c5ccd453c8e4278fe229e8c5 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Fri, 15 Jan 2021 19:23:32 +0900 Subject: [PATCH] Ignore deprecated warnings on spin_loop_hint --- crossbeam-utils/src/backoff.rs | 9 +++++++++ crossbeam-utils/src/lib.rs | 3 +++ 2 files changed, 12 insertions(+) diff --git a/crossbeam-utils/src/backoff.rs b/crossbeam-utils/src/backoff.rs index 04188e024..1012f06b2 100644 --- a/crossbeam-utils/src/backoff.rs +++ b/crossbeam-utils/src/backoff.rs @@ -145,6 +145,9 @@ impl Backoff { #[inline] pub fn spin(&self) { for _ in 0..1 << self.step.get().min(SPIN_LIMIT) { + // TODO(taiki-e): once we bump the minimum required Rust version to 1.49+, + // use [`core::hint::spin_loop`] instead. + #[allow(deprecated)] atomic::spin_loop_hint(); } @@ -205,11 +208,17 @@ impl Backoff { pub fn snooze(&self) { if self.step.get() <= SPIN_LIMIT { for _ in 0..1 << self.step.get() { + // TODO(taiki-e): once we bump the minimum required Rust version to 1.49+, + // use [`core::hint::spin_loop`] instead. + #[allow(deprecated)] atomic::spin_loop_hint(); } } else { #[cfg(not(feature = "std"))] for _ in 0..1 << self.step.get() { + // TODO(taiki-e): once we bump the minimum required Rust version to 1.49+, + // use [`core::hint::spin_loop`] instead. + #[allow(deprecated)] atomic::spin_loop_hint(); } diff --git a/crossbeam-utils/src/lib.rs b/crossbeam-utils/src/lib.rs index 3578ac740..5a400bef9 100644 --- a/crossbeam-utils/src/lib.rs +++ b/crossbeam-utils/src/lib.rs @@ -68,6 +68,9 @@ mod primitive { pub(crate) mod sync { pub(crate) mod atomic { pub(crate) use core::sync::atomic::compiler_fence; + // TODO(taiki-e): once we bump the minimum required Rust version to 1.49+, + // use [`core::hint::spin_loop`] instead. + #[allow(deprecated)] pub(crate) use core::sync::atomic::spin_loop_hint; pub(crate) use core::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize}; #[cfg(has_atomic_u16)]