From f6bb8111f280653c86f220847bd4eb04fa9bebca Mon Sep 17 00:00:00 2001 From: Samrat Man Singh Date: Tue, 14 Apr 2020 09:40:40 +0530 Subject: [PATCH] Use pre-defined u32 layout Also fix typo and remove newline --- src/shims/time.rs | 7 ++++--- tests/run-pass/time.rs | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shims/time.rs b/src/shims/time.rs index adcca21fb4c0..835541f9a957 100644 --- a/src/shims/time.rs +++ b/src/shims/time.rs @@ -169,13 +169,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx let info = this.deref_operand(info_op)?; - // Since we return nanoseceonds instead of ticks from + // Since we return nanoseconds instead of ticks from // `mach_absolute_time`, we don't need to scale the absolute // time. let (numer, denom) = (1,1); + let uint32_layout = this.layout_of(this.tcx.types.u32)?; let imms = [ - immty_from_int_checked(numer, this.libc_ty_layout("uint32_t")?)?, - immty_from_int_checked(denom, this.libc_ty_layout("uint32_t")?)? + immty_from_int_checked(numer, uint32_layout)?, + immty_from_int_checked(denom, uint32_layout)? ]; this.write_packed_immediates(info, &imms)?; diff --git a/tests/run-pass/time.rs b/tests/run-pass/time.rs index 9ae64fbae42a..2c9b579f7e29 100644 --- a/tests/run-pass/time.rs +++ b/tests/run-pass/time.rs @@ -24,7 +24,6 @@ fn main() { for _ in 0..10 { drop(vec![42]); } let now2 = Instant::now(); assert!(now2 > now1); - let diff = now2.duration_since(now1); assert_eq!(now1 + diff, now2); assert_eq!(now2 - diff, now1);