Skip to content

Commit

Permalink
Auto merge of #3141 - rust-lang:rustup-2023-10-25, r=RalfJung
Browse files Browse the repository at this point in the history
Automatic Rustup
  • Loading branch information
bors committed Oct 25, 2023
2 parents 4d1aae7 + 9fbff11 commit f40022d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f1a5ce19f5aa0cf61ed7b9f75b30e610befeed72
2e4e2a8f288f642cafcc41fff211955ceddc453d
12 changes: 4 additions & 8 deletions src/shims/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
"macos" => {
absolute_clocks = vec![this.eval_libc_i32("CLOCK_REALTIME")];
relative_clocks = vec![this.eval_libc_i32("CLOCK_MONOTONIC")];
// Some clocks only seem to exist in the aarch64 version of the target.
if this.tcx.sess.target.arch == "aarch64" {
// `CLOCK_UPTIME_RAW` supposed to not increment while the system is asleep... but
// that's not really something a program running inside Miri can tell, anyway.
// We need to support it because std uses it.
relative_clocks.push(this.eval_libc_i32("CLOCK_UPTIME_RAW"));
}
// `CLOCK_UPTIME_RAW` supposed to not increment while the system is asleep... but
// that's not really something a program running inside Miri can tell, anyway.
// We need to support it because std uses it.
relative_clocks.push(this.eval_libc_i32("CLOCK_UPTIME_RAW"));
}
target => throw_unsup_format!("`clock_gettime` is not supported on target OS {target}"),
}
Expand All @@ -68,7 +65,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
} else if relative_clocks.contains(&clk_id) {
this.machine.clock.now().duration_since(this.machine.clock.anchor())
} else {
// Unsupported clock.
let einval = this.eval_libc("EINVAL");
this.set_last_error(einval)?;
return Ok(Scalar::from_i32(-1));
Expand Down
12 changes: 12 additions & 0 deletions src/shims/windows/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,18 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {

this.Sleep(timeout)?;
}
"CreateWaitableTimerExW" => {
let [attributes, name, flags, access] =
this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?;
this.read_pointer(attributes)?;
this.read_pointer(name)?;
this.read_scalar(flags)?.to_u32()?;
this.read_scalar(access)?.to_u32()?;
// Unimplemented. Always return failure.
let not_supported = this.eval_windows("c", "ERROR_NOT_SUPPORTED");
this.set_last_error(not_supported)?;
this.write_null(dest)?;
}

// Synchronization primitives
"AcquireSRWLockExclusive" => {
Expand Down
2 changes: 1 addition & 1 deletion tests/pass-dep/shims/libc-misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ fn test_clocks() {
unsafe { libc::clock_gettime(libc::CLOCK_MONOTONIC_COARSE, tp.as_mut_ptr()) };
assert_eq!(is_error, 0);
}
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
#[cfg(target_os = "macos")]
{
let is_error = unsafe { libc::clock_gettime(libc::CLOCK_UPTIME_RAW, tp.as_mut_ptr()) };
assert_eq!(is_error, 0);
Expand Down

0 comments on commit f40022d

Please sign in to comment.