Skip to content

Commit

Permalink
Support MSRV 1.63
Browse files Browse the repository at this point in the history
pointer::cast_mut was stablised in 1.65, so it's too new.
  • Loading branch information
Thomasdezeeuw committed Jun 8, 2023
1 parent fc41670 commit 54e7215
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ impl<'addr, 'bufs, 'control> MsgHdr<'addr, 'bufs, 'control> {
/// Corresponds to setting `msg_iov` and `msg_iovlen` on Unix and `lpBuffers`
/// and `dwBufferCount` on Windows.
pub fn with_buffers(mut self, bufs: &'bufs [IoSlice<'_>]) -> Self {
let ptr = bufs.as_ptr().cast_mut().cast();
let ptr = bufs.as_ptr() as *mut _;
sys::set_msghdr_iov(&mut self.inner, ptr, bufs.len());
self
}
Expand All @@ -616,7 +616,7 @@ impl<'addr, 'bufs, 'control> MsgHdr<'addr, 'bufs, 'control> {
/// Corresponds to setting `msg_control` and `msg_controllen` on Unix and
/// `Control` on Windows.
pub fn with_control(mut self, buf: &'control [u8]) -> Self {
let ptr = buf.as_ptr().cast_mut().cast();
let ptr = buf.as_ptr() as *mut _;
sys::set_msghdr_control(&mut self.inner, ptr, buf.len());
self
}
Expand Down
3 changes: 2 additions & 1 deletion src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,11 +648,12 @@ pub(crate) use libc::msghdr;

#[cfg(not(target_os = "redox"))]
pub(crate) fn set_msghdr_name(msg: &mut msghdr, name: &SockAddr) {
msg.msg_name = name.as_ptr().cast_mut().cast();
msg.msg_name = name.as_ptr() as *mut _;
msg.msg_namelen = name.len();
}

#[cfg(not(target_os = "redox"))]
#[allow(clippy::unnecessary_cast)] // IovLen type can be `usize`.
pub(crate) fn set_msghdr_iov(msg: &mut msghdr, ptr: *mut libc::iovec, len: usize) {
msg.msg_iov = ptr;
msg.msg_iovlen = min(len, IovLen::MAX as usize) as IovLen;
Expand Down
2 changes: 1 addition & 1 deletion src/sys/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl<'a> MaybeUninitSlice<'a> {
pub(crate) use windows_sys::Win32::Networking::WinSock::WSAMSG as msghdr;

pub(crate) fn set_msghdr_name(msg: &mut msghdr, name: &SockAddr) {
msg.name = name.as_ptr().cast_mut().cast();
msg.name = name.as_ptr() as *mut _;
msg.namelen = name.len();
}

Expand Down

0 comments on commit 54e7215

Please sign in to comment.