Skip to content
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

Rollup of 9 pull requests #128142

Merged
merged 27 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
91af6b5
Add edge-case examples to `{count,leading,trailing}_{ones,zeros}` met…
fitzgen Jul 2, 2024
6519c14
Reset sigpipe not supported for vxworks
Jul 8, 2024
287b66b
size_of_val_raw: for length 0 this is safe to call
RalfJung Jun 8, 2024
f6fe7e4
lib: replace some `mem::forget`'s with `ManuallyDrop`
GrigorenkoPV Jul 14, 2024
c807ac0
Use verbose suggestion for "wrong # of generics"
estebank Jul 5, 2024
5c2b36a
Change suggestion message wording
estebank Jul 5, 2024
b30fdec
On generic and lifetime removal suggestion, do not leave behind stray…
estebank Jul 5, 2024
921de9d
Revert suggestion verbosity change
estebank Jul 22, 2024
2561d91
Allow unused unsafe for vxworks in read_at and write at
Jul 23, 2024
a598ca0
Disable dirfd for vxworks, Return unsupported error from set_times an…
Jul 23, 2024
5c9f376
Cfg disable on_broken_pipe_flag_used() for vxworks
Jul 23, 2024
786ad3d
Update process vxworks, set default stack size of 256 Kib for vxworks…
Jul 23, 2024
23e346e
make tidy fast without compromising case alternation
donno2048 Jul 23, 2024
b82f878
Gate AsyncFn* under async_closure feature
compiler-errors Jul 23, 2024
0ea5694
Add chroot unsupported implementation for VxWorks
Jul 24, 2024
9b87fbc
Import `core::ffi::c_void` in more places
ChrisDenton Jul 24, 2024
7cd25b1
Forbid unsafe_op_in_unsafe_fn in sys/pal/windows
ChrisDenton Jul 24, 2024
ac26b88
Improve spans on evaluated `cfg_attr`s.
nnethercote Jul 24, 2024
130d15e
Rollup merge of #126152 - RalfJung:size_of_val_raw, r=saethlin
matthiaskrgr Jul 24, 2024
720c6f1
Rollup merge of #127252 - fitzgen:edge-cases-for-bitwise-operations, …
matthiaskrgr Jul 24, 2024
91c03ef
Rollup merge of #127374 - estebank:wrong-generic-args, r=oli-obk
matthiaskrgr Jul 24, 2024
122b0b2
Rollup merge of #127457 - donno2048:master, r=albertlarsan68
matthiaskrgr Jul 24, 2024
ce523d6
Rollup merge of #127480 - biabbas:vxworks, r=workingjubilee
matthiaskrgr Jul 24, 2024
34abb96
Rollup merge of #127733 - GrigorenkoPV:don't-forget, r=Amanieu
matthiaskrgr Jul 24, 2024
e342efe
Rollup merge of #128120 - compiler-errors:async-fn-name, r=oli-obk
matthiaskrgr Jul 24, 2024
f3a7c3f
Rollup merge of #128131 - ChrisDenton:stuff, r=workingjubilee
matthiaskrgr Jul 24, 2024
2dc88bf
Rollup merge of #128133 - nnethercote:fix-cfg_attr-spans, r=petrochenkov
matthiaskrgr Jul 24, 2024
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
Prev Previous commit
Next Next commit
Import core::ffi::c_void in more places
  • Loading branch information
ChrisDenton committed Jul 24, 2024
commit 9b87fbc3e5394a93489003aea38e44c2d2735c7b
8 changes: 4 additions & 4 deletions library/std/src/sys/pal/windows/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ windows_targets::link!("kernel32.dll" "system" fn GetProcessHeap() -> c::HANDLE)
// Note that `dwBytes` is allowed to be zero, contrary to some other allocators.
//
// See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-heapalloc
windows_targets::link!("kernel32.dll" "system" fn HeapAlloc(hheap: c::HANDLE, dwflags: u32, dwbytes: usize) -> *mut core::ffi::c_void);
windows_targets::link!("kernel32.dll" "system" fn HeapAlloc(hheap: c::HANDLE, dwflags: u32, dwbytes: usize) -> *mut c_void);

// Reallocate a block of memory behind a given pointer `lpMem` from a given heap `hHeap`,
// to a block of at least `dwBytes` bytes, either shrinking the block in place,
Expand All @@ -61,9 +61,9 @@ windows_targets::link!("kernel32.dll" "system" fn HeapAlloc(hheap: c::HANDLE, dw
windows_targets::link!("kernel32.dll" "system" fn HeapReAlloc(
hheap: c::HANDLE,
dwflags : u32,
lpmem: *const core::ffi::c_void,
lpmem: *const c_void,
dwbytes: usize
) -> *mut core::ffi::c_void);
) -> *mut c_void);

// Free a block of memory behind a given pointer `lpMem` from a given heap `hHeap`.
// Returns a nonzero value if the operation is successful, and zero if the operation fails.
Expand All @@ -79,7 +79,7 @@ windows_targets::link!("kernel32.dll" "system" fn HeapReAlloc(
// Note that `lpMem` is allowed to be null, which will not cause the operation to fail.
//
// See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-heapfree
windows_targets::link!("kernel32.dll" "system" fn HeapFree(hheap: c::HANDLE, dwflags: u32, lpmem: *const core::ffi::c_void) -> c::BOOL);
windows_targets::link!("kernel32.dll" "system" fn HeapFree(hheap: c::HANDLE, dwflags: u32, lpmem: *const c_void) -> c::BOOL);

// Cached handle to the default heap of the current process.
// Either a non-null handle returned by `GetProcessHeap`, or null when not yet initialized or `GetProcessHeap` failed.
Expand Down
24 changes: 11 additions & 13 deletions library/std/src/sys/pal/windows/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
#![cfg_attr(test, allow(dead_code))]
#![unstable(issue = "none", feature = "windows_c")]
#![allow(clippy::style)]
#![allow(unsafe_op_in_unsafe_fn)]

use crate::ffi::CStr;
use crate::mem;
use crate::os::raw::{c_uint, c_ulong, c_ushort, c_void};
use crate::ptr;
use core::ffi::{c_uint, c_ulong, c_ushort, c_void, CStr};
use core::mem;
use core::ptr;

pub(super) mod windows_targets;

Expand Down Expand Up @@ -188,12 +186,12 @@ extern "system" {
compat_fn_optional! {
crate::sys::compat::load_synch_functions();
pub fn WaitOnAddress(
address: *const ::core::ffi::c_void,
compareaddress: *const ::core::ffi::c_void,
address: *const c_void,
compareaddress: *const c_void,
addresssize: usize,
dwmilliseconds: u32
) -> BOOL;
pub fn WakeByAddressSingle(address: *const ::core::ffi::c_void);
pub fn WakeByAddressSingle(address: *const c_void);
}

#[cfg(any(target_vendor = "win7", target_vendor = "uwp"))]
Expand Down Expand Up @@ -240,7 +238,7 @@ compat_fn_with_fallback! {
shareaccess: FILE_SHARE_MODE,
createdisposition: NTCREATEFILE_CREATE_DISPOSITION,
createoptions: NTCREATEFILE_CREATE_OPTIONS,
eabuffer: *const ::core::ffi::c_void,
eabuffer: *const c_void,
ealength: u32
) -> NTSTATUS {
STATUS_NOT_IMPLEMENTED
Expand All @@ -250,9 +248,9 @@ compat_fn_with_fallback! {
filehandle: HANDLE,
event: HANDLE,
apcroutine: PIO_APC_ROUTINE,
apccontext: *const core::ffi::c_void,
apccontext: *const c_void,
iostatusblock: *mut IO_STATUS_BLOCK,
buffer: *mut core::ffi::c_void,
buffer: *mut c_void,
length: u32,
byteoffset: *const i64,
key: *const u32
Expand All @@ -264,9 +262,9 @@ compat_fn_with_fallback! {
filehandle: HANDLE,
event: HANDLE,
apcroutine: PIO_APC_ROUTINE,
apccontext: *const core::ffi::c_void,
apccontext: *const c_void,
iostatusblock: *mut IO_STATUS_BLOCK,
buffer: *const core::ffi::c_void,
buffer: *const c_void,
length: u32,
byteoffset: *const i64,
key: *const u32
Expand Down
11 changes: 6 additions & 5 deletions library/std/src/sys/pal/windows/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
#[cfg(test)]
mod tests;

use crate::cmp;
use crate::io::{self, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut, Read};
use crate::mem;
use crate::os::windows::io::{
AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, IntoRawHandle, OwnedHandle, RawHandle,
};
use crate::ptr;
use crate::sys::c;
use crate::sys::cvt;
use crate::sys_common::{AsInner, FromInner, IntoInner};
use core::cmp;
use core::ffi::c_void;
use core::mem;
use core::ptr;

/// An owned container for `HANDLE` object, closing them on Drop.
///
Expand Down Expand Up @@ -255,7 +256,7 @@ impl Handle {
None,
ptr::null_mut(),
&mut io_status,
buf.cast::<core::ffi::c_void>(),
buf.cast::<c_void>(),
len,
offset.as_ref().map(|n| ptr::from_ref(n).cast::<i64>()).unwrap_or(ptr::null()),
ptr::null(),
Expand Down Expand Up @@ -305,7 +306,7 @@ impl Handle {
None,
ptr::null_mut(),
&mut io_status,
buf.as_ptr().cast::<core::ffi::c_void>(),
buf.as_ptr().cast::<c_void>(),
len,
offset.as_ref().map(|n| ptr::from_ref(n).cast::<i64>()).unwrap_or(ptr::null()),
ptr::null(),
Expand Down