Skip to content

Commit c834637

Browse files
committed
address review comments
1 parent b16d301 commit c834637

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

src/clock.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
use std::sync::atomic::AtomicU64;
1+
use std::sync::atomic::{AtomicU64, Ordering};
22
use std::time::{Duration, Instant as StdInstant};
33

4-
use rustc_data_structures::sync::Ordering;
5-
6-
use crate::*;
7-
8-
/// When using a virtual clock, this defines how many nanoseconds do we pretend
9-
/// are passing for each basic block.
10-
const NANOSECOND_PER_BASIC_BLOCK: u64 = 10;
4+
/// When using a virtual clock, this defines how many nanoseconds we pretend are passing for each
5+
/// basic block.
6+
const NANOSECONDS_PER_BASIC_BLOCK: u64 = 10;
117

128
#[derive(Debug)]
139
pub struct Instant {
@@ -83,7 +79,7 @@ impl Clock {
8379
// Time will pass without us doing anything.
8480
}
8581
ClockKind::Virtual { nanoseconds } => {
86-
nanoseconds.fetch_add(NANOSECOND_PER_BASIC_BLOCK, Ordering::SeqCst);
82+
nanoseconds.fetch_add(NANOSECONDS_PER_BASIC_BLOCK, Ordering::SeqCst);
8783
}
8884
}
8985
}

src/shims/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
3838
[this.eval_libc_i32("CLOCK_MONOTONIC")?, this.eval_libc_i32("CLOCK_MONOTONIC_COARSE")?];
3939

4040
let duration = if absolute_clocks.contains(&clk_id) {
41-
this.check_no_isolation("`clock_gettime` with real time clocks")?;
41+
this.check_no_isolation("`clock_gettime` with `REALTIME` clocks")?;
4242
system_time_to_duration(&SystemTime::now())?
4343
} else if relative_clocks.contains(&clk_id) {
4444
this.machine.clock.now().duration_since(this.machine.clock.anchor())

tests/pass/shims/time-with-isolation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn test_sleep() {
88
assert!((after - before).as_secs() >= 3600);
99
}
1010

11-
/// Ensure that time passes even if we don't sleep (but just wor).
11+
/// Ensure that time passes even if we don't sleep (but just work).
1212
fn test_time_passes() {
1313
// Check `Instant`.
1414
let now1 = Instant::now();

0 commit comments

Comments
 (0)