Skip to content

Commit 4202856

Browse files
committed
deny unsafe in unsafe in pal/windows/net.rs
1 parent b221712 commit 4202856

File tree

1 file changed

+6
-5
lines changed
  • library/std/src/sys/pal/windows

1 file changed

+6
-5
lines changed

library/std/src/sys/pal/windows/net.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![unstable(issue = "none", feature = "windows_net")]
2+
#![deny(unsafe_op_in_unsafe_fn)]
23

34
use crate::cmp;
45
use crate::io::{self, BorrowedBuf, BorrowedCursor, IoSlice, IoSliceMut, Read};
@@ -92,7 +93,7 @@ pub mod netc {
9293
}
9394

9495
pub unsafe fn send(socket: SOCKET, buf: *const c_void, len: c_int, flags: c_int) -> c_int {
95-
c::send(socket, buf.cast::<u8>(), len, flags)
96+
unsafe { c::send(socket, buf.cast::<u8>(), len, flags) }
9697
}
9798
pub unsafe fn sendto(
9899
socket: SOCKET,
@@ -102,15 +103,15 @@ pub mod netc {
102103
addr: *const SOCKADDR,
103104
addrlen: c_int,
104105
) -> c_int {
105-
c::sendto(socket, buf.cast::<u8>(), len, flags, addr, addrlen)
106+
unsafe { c::sendto(socket, buf.cast::<u8>(), len, flags, addr, addrlen) }
106107
}
107108
pub unsafe fn getaddrinfo(
108109
node: *const c_char,
109110
service: *const c_char,
110111
hints: *const ADDRINFOA,
111112
res: *mut *mut ADDRINFOA,
112113
) -> c_int {
113-
c::getaddrinfo(node.cast::<u8>(), service.cast::<u8>(), hints, res)
114+
unsafe { c::getaddrinfo(node.cast::<u8>(), service.cast::<u8>(), hints, res) }
114115
}
115116
}
116117

@@ -523,7 +524,7 @@ impl Socket {
523524
pub unsafe fn from_raw(raw: c::SOCKET) -> Self {
524525
debug_assert_eq!(mem::size_of::<c::SOCKET>(), mem::size_of::<RawSocket>());
525526
debug_assert_eq!(mem::align_of::<c::SOCKET>(), mem::align_of::<RawSocket>());
526-
Self::from_raw_socket(raw as RawSocket)
527+
unsafe { Self::from_raw_socket(raw as RawSocket) }
527528
}
528529
}
529530

@@ -573,6 +574,6 @@ impl IntoRawSocket for Socket {
573574

574575
impl FromRawSocket for Socket {
575576
unsafe fn from_raw_socket(raw_socket: RawSocket) -> Self {
576-
Self(FromRawSocket::from_raw_socket(raw_socket))
577+
unsafe { Self(FromRawSocket::from_raw_socket(raw_socket)) }
577578
}
578579
}

0 commit comments

Comments
 (0)