Skip to content

Commit f6bb811

Browse files
committed
Use pre-defined u32 layout
Also fix typo and remove newline
1 parent 5f6d250 commit f6bb811

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/shims/time.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
169169

170170
let info = this.deref_operand(info_op)?;
171171

172-
// Since we return nanoseceonds instead of ticks from
172+
// Since we return nanoseconds instead of ticks from
173173
// `mach_absolute_time`, we don't need to scale the absolute
174174
// time.
175175
let (numer, denom) = (1,1);
176+
let uint32_layout = this.layout_of(this.tcx.types.u32)?;
176177
let imms = [
177-
immty_from_int_checked(numer, this.libc_ty_layout("uint32_t")?)?,
178-
immty_from_int_checked(denom, this.libc_ty_layout("uint32_t")?)?
178+
immty_from_int_checked(numer, uint32_layout)?,
179+
immty_from_int_checked(denom, uint32_layout)?
179180
];
180181

181182
this.write_packed_immediates(info, &imms)?;

tests/run-pass/time.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ fn main() {
2424
for _ in 0..10 { drop(vec![42]); }
2525
let now2 = Instant::now();
2626
assert!(now2 > now1);
27-
2827
let diff = now2.duration_since(now1);
2928
assert_eq!(now1 + diff, now2);
3029
assert_eq!(now2 - diff, now1);

0 commit comments

Comments
 (0)