about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Poveda <git@pvdrz.com>2022-09-12 16:32:09 -0500
committerChristian Poveda <git@pvdrz.com>2022-09-13 15:16:41 -0500
commitc8346376264ea99cafd6550b5b5f460cf82b326f (patch)
treed4aff5aa053c6916728623863cd834b54d329d58
parentb16d301dd9f2138b91a05e398a61d3ddeb8f6b7b (diff)
downloadrust-c8346376264ea99cafd6550b5b5f460cf82b326f.tar.gz
rust-c8346376264ea99cafd6550b5b5f460cf82b326f.zip
address review comments
-rw-r--r--src/clock.rs14
-rw-r--r--src/shims/time.rs2
-rw-r--r--tests/pass/shims/time-with-isolation.rs2
3 files changed, 7 insertions, 11 deletions
diff --git a/src/clock.rs b/src/clock.rs
index 4fab2b2c5f3..3f33273e1e5 100644
--- a/src/clock.rs
+++ b/src/clock.rs
@@ -1,13 +1,9 @@
-use std::sync::atomic::AtomicU64;
+use std::sync::atomic::{AtomicU64, Ordering};
 use std::time::{Duration, Instant as StdInstant};
 
-use rustc_data_structures::sync::Ordering;
-
-use crate::*;
-
-/// When using a virtual clock, this defines how many nanoseconds do we pretend
-/// are passing for each basic block.
-const NANOSECOND_PER_BASIC_BLOCK: u64 = 10;
+/// When using a virtual clock, this defines how many nanoseconds we pretend are passing for each
+/// basic block.
+const NANOSECONDS_PER_BASIC_BLOCK: u64 = 10;
 
 #[derive(Debug)]
 pub struct Instant {
@@ -83,7 +79,7 @@ impl Clock {
                 // Time will pass without us doing anything.
             }
             ClockKind::Virtual { nanoseconds } => {
-                nanoseconds.fetch_add(NANOSECOND_PER_BASIC_BLOCK, Ordering::SeqCst);
+                nanoseconds.fetch_add(NANOSECONDS_PER_BASIC_BLOCK, Ordering::SeqCst);
             }
         }
     }
diff --git a/src/shims/time.rs b/src/shims/time.rs
index 933c298ee4d..f083ab49900 100644
--- a/src/shims/time.rs
+++ b/src/shims/time.rs
@@ -38,7 +38,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
             [this.eval_libc_i32("CLOCK_MONOTONIC")?, this.eval_libc_i32("CLOCK_MONOTONIC_COARSE")?];
 
         let duration = if absolute_clocks.contains(&clk_id) {
-            this.check_no_isolation("`clock_gettime` with real time clocks")?;
+            this.check_no_isolation("`clock_gettime` with `REALTIME` clocks")?;
             system_time_to_duration(&SystemTime::now())?
         } else if relative_clocks.contains(&clk_id) {
             this.machine.clock.now().duration_since(this.machine.clock.anchor())
diff --git a/tests/pass/shims/time-with-isolation.rs b/tests/pass/shims/time-with-isolation.rs
index 7e6c74d71cb..b6444319b59 100644
--- a/tests/pass/shims/time-with-isolation.rs
+++ b/tests/pass/shims/time-with-isolation.rs
@@ -8,7 +8,7 @@ fn test_sleep() {
     assert!((after - before).as_secs() >= 3600);
 }
 
-/// Ensure that time passes even if we don't sleep (but just wor).
+/// Ensure that time passes even if we don't sleep (but just work).
 fn test_time_passes() {
     // Check `Instant`.
     let now1 = Instant::now();