Skip to content

Commit fe4fde2

Browse files
authored
Rollup merge of #117044 - RalfJung:miri, r=RalfJung
Miri subtree update This should unblock #116581
2 parents dde77f7 + f35c36a commit fe4fde2

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

Diff for: src/tools/miri/rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
249624b5043013d18c00f0401ca431c1a6baa8cd
1+
9e3f784eb2c7c847b6c3578b373c0e0bc9233ca3

Diff for: src/tools/miri/src/clock.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::sync::atomic::{AtomicU64, Ordering};
1+
use std::cell::Cell;
22
use std::time::{Duration, Instant as StdInstant};
33

44
/// When using a virtual clock, this defines how many nanoseconds we pretend are passing for each
@@ -59,7 +59,7 @@ enum ClockKind {
5959
},
6060
Virtual {
6161
/// The "current virtual time".
62-
nanoseconds: AtomicU64,
62+
nanoseconds: Cell<u64>,
6363
},
6464
}
6565

@@ -82,7 +82,7 @@ impl Clock {
8282
// Time will pass without us doing anything.
8383
}
8484
ClockKind::Virtual { nanoseconds } => {
85-
nanoseconds.fetch_add(NANOSECONDS_PER_BASIC_BLOCK, Ordering::SeqCst);
85+
nanoseconds.update(|x| x + NANOSECONDS_PER_BASIC_BLOCK);
8686
}
8787
}
8888
}
@@ -93,7 +93,8 @@ impl Clock {
9393
ClockKind::Host { .. } => std::thread::sleep(duration),
9494
ClockKind::Virtual { nanoseconds } => {
9595
// Just pretend that we have slept for some time.
96-
nanoseconds.fetch_add(duration.as_nanos().try_into().unwrap(), Ordering::SeqCst);
96+
let nanos: u64 = duration.as_nanos().try_into().unwrap();
97+
nanoseconds.update(|x| x + nanos);
9798
}
9899
}
99100
}
@@ -110,9 +111,7 @@ impl Clock {
110111
match &self.kind {
111112
ClockKind::Host { .. } => Instant { kind: InstantKind::Host(StdInstant::now()) },
112113
ClockKind::Virtual { nanoseconds } =>
113-
Instant {
114-
kind: InstantKind::Virtual { nanoseconds: nanoseconds.load(Ordering::SeqCst) },
115-
},
114+
Instant { kind: InstantKind::Virtual { nanoseconds: nanoseconds.get() } },
116115
}
117116
}
118117
}

Diff for: src/tools/miri/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(rustc_private)]
2+
#![feature(cell_update)]
23
#![feature(float_gamma)]
34
#![feature(map_try_insert)]
45
#![feature(never_type)]

Diff for: src/tools/miri/src/shims/backtrace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
3737
let this = self.eval_context_mut();
3838
let tcx = this.tcx;
3939

40-
let flags = if let Some(flags_op) = args.get(0) {
40+
let flags = if let Some(flags_op) = args.first() {
4141
this.read_scalar(flags_op)?.to_u64()?
4242
} else {
4343
throw_ub_format!("expected at least 1 argument")

0 commit comments

Comments
 (0)