Skip to content

Fix *-win7-windows-msvc target since 26eeac1a1e9fe46ffd80dd0d3dafdd2c2a644306 #137270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library/std/src/sys/pal/windows/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ compat_fn_with_fallback! {
pub fn NtReleaseKeyedEvent(
EventHandle: HANDLE,
Key: *const c_void,
Alertable: BOOLEAN,
Alertable: bool,
Timeout: *mut i64
) -> NTSTATUS {
panic!("keyed events not available")
Expand All @@ -213,7 +213,7 @@ compat_fn_with_fallback! {
pub fn NtWaitForKeyedEvent(
EventHandle: HANDLE,
Key: *const c_void,
Alertable: BOOLEAN,
Alertable: bool,
Timeout: *mut i64
) -> NTSTATUS {
panic!("keyed events not available")
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/random/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn fill_bytes(mut bytes: &mut [u8]) {
while !bytes.is_empty() {
let len = bytes.len().try_into().unwrap_or(u32::MAX);
let ret = unsafe { c::RtlGenRandom(bytes.as_mut_ptr().cast(), len) };
assert_ne!(ret, 0, "failed to generate random data");
assert!(ret, "failed to generate random data");
bytes = &mut bytes[len as usize..];
}
}
2 changes: 1 addition & 1 deletion library/std/src/sys/sync/mutex/windows7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl Mutex {

#[inline]
pub fn try_lock(&self) -> bool {
unsafe { c::TryAcquireSRWLockExclusive(raw(self)) != 0 }
unsafe { c::TryAcquireSRWLockExclusive(raw(self)) }
}

#[inline]
Expand Down
8 changes: 4 additions & 4 deletions library/std/src/sys/sync/thread_parking/windows7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ mod keyed_events {

pub unsafe fn park(parker: Pin<&Parker>) {
// Wait for unpark() to produce this event.
c::NtWaitForKeyedEvent(keyed_event_handle(), parker.ptr(), 0, ptr::null_mut());
c::NtWaitForKeyedEvent(keyed_event_handle(), parker.ptr(), false, ptr::null_mut());
// Set the state back to EMPTY (from either PARKED or NOTIFIED).
// Note that we don't just write EMPTY, but use swap() to also
// include an acquire-ordered read to synchronize with unpark()'s
Expand All @@ -218,7 +218,7 @@ mod keyed_events {

// Wait for unpark() to produce this event.
let unparked =
c::NtWaitForKeyedEvent(handle, parker.ptr(), 0, &mut timeout) == c::STATUS_SUCCESS;
c::NtWaitForKeyedEvent(handle, parker.ptr(), false, &mut timeout) == c::STATUS_SUCCESS;

// Set the state back to EMPTY (from either PARKED or NOTIFIED).
let prev_state = parker.state.swap(EMPTY, Acquire);
Expand All @@ -228,7 +228,7 @@ mod keyed_events {
// was set to NOTIFIED, which means we *just* missed an
// unpark(), which is now blocked on us to wait for it.
// Wait for it to consume the event and unblock that thread.
c::NtWaitForKeyedEvent(handle, parker.ptr(), 0, ptr::null_mut());
c::NtWaitForKeyedEvent(handle, parker.ptr(), false, ptr::null_mut());
}
}
pub unsafe fn unpark(parker: Pin<&Parker>) {
Expand All @@ -239,7 +239,7 @@ mod keyed_events {
// To prevent this thread from blocking indefinitely in that case,
// park_impl() will, after seeing the state set to NOTIFIED after
// waking up, call NtWaitForKeyedEvent again to unblock us.
c::NtReleaseKeyedEvent(keyed_event_handle(), parker.ptr(), 0, ptr::null_mut());
c::NtReleaseKeyedEvent(keyed_event_handle(), parker.ptr(), false, ptr::null_mut());
}

fn keyed_event_handle() -> c::HANDLE {
Expand Down
Loading