Skip to content

Commit fbf99e4

Browse files
committed
Allow the deprecated ATOMIC_USIZE_INIT
Nightly 1.34 suggests the const `AtomicUsize::new()` instead, but we still want to support older compilers, so just allow it for now.
1 parent b4553ab commit fbf99e4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

rayon-core/src/registry.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ use std::cell::Cell;
1313
use std::collections::hash_map::DefaultHasher;
1414
use std::hash::Hasher;
1515
use std::mem;
16-
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
16+
use std::sync::atomic::{AtomicUsize, Ordering};
17+
#[allow(deprecated)]
18+
use std::sync::atomic::ATOMIC_USIZE_INIT;
1719
use std::sync::{Arc, Once, ONCE_INIT};
1820
use std::thread;
1921
use std::usize;
@@ -748,6 +750,7 @@ impl XorShift64Star {
748750
let mut seed = 0;
749751
while seed == 0 {
750752
let mut hasher = DefaultHasher::new();
753+
#[allow(deprecated)]
751754
static COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
752755
hasher.write_usize(COUNTER.fetch_add(1, Ordering::Relaxed));
753756
seed = hasher.finish();

tests/sort-panic-safe.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ use std::cell::Cell;
1010
use std::cmp::{self, Ordering};
1111
use std::panic;
1212
use std::sync::atomic::Ordering::Relaxed;
13-
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};
13+
use std::sync::atomic::AtomicUsize;
14+
#[allow(deprecated)]
15+
use std::sync::atomic::ATOMIC_USIZE_INIT;
1416
use std::thread;
1517

18+
#[allow(deprecated)]
1619
static VERSIONS: AtomicUsize = ATOMIC_USIZE_INIT;
1720

1821
lazy_static! {

0 commit comments

Comments
 (0)