Skip to content

Commit b7cda32

Browse files
committed
Allow miri to access time and run rustfmt
1 parent 74db994 commit b7cda32

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- script: cargo miri test
5050
displayName: cargo miri test
5151
env:
52-
MIRIFLAGS: -Zmiri-ignore-leaks
52+
MIRIFLAGS: "-Zmiri-ignore-leaks -Zmiri-disable-isolation"
5353
- job: loom
5454
displayName: "Run loom on test suite"
5555
pool:

src/domain.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ use core::sync::atomic::Ordering;
99
// `SYNC_TIME_PERIOD` nanoseconds. The next time we should run reclamation is stored in
1010
// `due_time` inside `Domain`. On `no_std` we don't (yet) have access to time so this feature is
1111
// disabled. Also on platforms with < 64 bits, we can only store 2^32 nanoseconds -> ~4 seconds or
12-
// less, so this feature is also disabled. Additionally, miri can't support time because of
13-
// system calls (perhaps this can be mocked), and loom can't support time for reasons of determinism.
12+
// less, so this feature is also disabled. Additionally, loom can't support time for reasons of
13+
// determinism.
1414

15-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
15+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
1616
const SYNC_TIME_PERIOD: u64 = std::time::Duration::from_nanos(2000000000).as_nanos() as u64;
17-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
17+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
1818
use crate::sync::atomic::AtomicU64;
1919

2020
#[cfg(loom)]
@@ -62,7 +62,7 @@ pub struct Domain<F> {
6262
hazptrs: HazPtrRecords,
6363
untagged: [RetiredList; NUM_SHARDS],
6464
family: PhantomData<F>,
65-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
65+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
6666
due_time: AtomicU64,
6767
nbulk_reclaims: AtomicUsize,
6868
count: AtomicIsize,
@@ -111,7 +111,7 @@ macro_rules! new {
111111
},
112112
untagged,
113113
count: AtomicIsize::new(0),
114-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
114+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
115115
due_time: AtomicU64::new(0),
116116
nbulk_reclaims: AtomicUsize::new(0),
117117
family: PhantomData,
@@ -368,7 +368,7 @@ impl<F> Domain<F> {
368368
.compare_exchange_weak(rcount, 0, Ordering::AcqRel, Ordering::Relaxed)
369369
{
370370
Ok(_) => {
371-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
371+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
372372
{
373373
self.due_time
374374
.store(Self::now() + SYNC_TIME_PERIOD, Ordering::Release);
@@ -381,7 +381,7 @@ impl<F> Domain<F> {
381381
0
382382
}
383383

384-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
384+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
385385
fn check_due_time(&self) -> isize {
386386
let time = Self::now();
387387
let due = self.due_time.load(Ordering::Acquire);
@@ -409,7 +409,7 @@ impl<F> Domain<F> {
409409
// TODO: Implement some kind of mock time for no_std.
410410
// Currently we reclaim only based on rcount on no_std
411411
// (also the reason for allow unused_mut)
412-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
412+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
413413
{
414414
rcount = self.check_due_time();
415415
}
@@ -553,7 +553,7 @@ impl<F> Domain<F> {
553553
0
554554
}
555555

556-
#[cfg(all(feature = "std", target_pointer_width = "64", not(miri), not(loom)))]
556+
#[cfg(all(feature = "std", target_pointer_width = "64", not(loom)))]
557557
fn now() -> u64 {
558558
use std::convert::TryFrom;
559559
u64::try_from(

src/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ pub(crate) use loom::thread::yield_now;
1010

1111
#[cfg(not(loom))]
1212
pub(crate) mod atomic {
13-
pub(crate) use core::sync::atomic::{fence, AtomicIsize, AtomicPtr, AtomicUsize};
1413
#[cfg(target_pointer_width = "64")]
1514
pub use core::sync::atomic::AtomicU64;
15+
pub(crate) use core::sync::atomic::{fence, AtomicIsize, AtomicPtr, AtomicUsize};
1616
}
1717
#[cfg(all(not(loom), feature = "std"))]
1818
pub(crate) use std::thread::yield_now;

0 commit comments

Comments
 (0)