Skip to content

Commit 90cd7dc

Browse files
bors[bot]taiki-e
andauthored
Merge #647
647: Ignore deprecated warnings on spin_loop_hint r=taiki-e a=taiki-e `spin_loop_hint` is deprecated in 1.51. (rust-lang/rust#80966) However, the alternative (`hint::spin_loop`) requires Rust 1.49+, so ignore deprecated warnings for now. Co-authored-by: Taiki Endo <[email protected]>
2 parents 99c66ec + 7e54f8b commit 90cd7dc

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

crossbeam-utils/src/backoff.rs

+9
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ impl Backoff {
145145
#[inline]
146146
pub fn spin(&self) {
147147
for _ in 0..1 << self.step.get().min(SPIN_LIMIT) {
148+
// TODO(taiki-e): once we bump the minimum required Rust version to 1.49+,
149+
// use [`core::hint::spin_loop`] instead.
150+
#[allow(deprecated)]
148151
atomic::spin_loop_hint();
149152
}
150153

@@ -205,11 +208,17 @@ impl Backoff {
205208
pub fn snooze(&self) {
206209
if self.step.get() <= SPIN_LIMIT {
207210
for _ in 0..1 << self.step.get() {
211+
// TODO(taiki-e): once we bump the minimum required Rust version to 1.49+,
212+
// use [`core::hint::spin_loop`] instead.
213+
#[allow(deprecated)]
208214
atomic::spin_loop_hint();
209215
}
210216
} else {
211217
#[cfg(not(feature = "std"))]
212218
for _ in 0..1 << self.step.get() {
219+
// TODO(taiki-e): once we bump the minimum required Rust version to 1.49+,
220+
// use [`core::hint::spin_loop`] instead.
221+
#[allow(deprecated)]
213222
atomic::spin_loop_hint();
214223
}
215224

crossbeam-utils/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ mod primitive {
6868
pub(crate) mod sync {
6969
pub(crate) mod atomic {
7070
pub(crate) use core::sync::atomic::compiler_fence;
71+
// TODO(taiki-e): once we bump the minimum required Rust version to 1.49+,
72+
// use [`core::hint::spin_loop`] instead.
73+
#[allow(deprecated)]
7174
pub(crate) use core::sync::atomic::spin_loop_hint;
7275
pub(crate) use core::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize};
7376
#[cfg(has_atomic_u16)]

0 commit comments

Comments
 (0)