mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
RawSocket is unsigned on Windows.
This commit is contained in:
parent
78806d4cfe
commit
a5077f1342
@ -8,15 +8,14 @@ fn test_niche_optimizations_socket() {
|
||||
assert_eq!(size_of::<Option<OwnedSocket>>(), size_of::<RawSocket>());
|
||||
assert_eq!(size_of::<Option<BorrowedSocket<'static>>>(), size_of::<RawSocket>(),);
|
||||
unsafe {
|
||||
assert_eq!(OwnedSocket::from_raw_socket(RawSocket::MIN).into_raw_socket(), RawSocket::MIN);
|
||||
assert_eq!(OwnedSocket::from_raw_socket(RawSocket::MAX).into_raw_socket(), RawSocket::MAX);
|
||||
assert_eq!(
|
||||
Some(OwnedSocket::from_raw_socket(RawSocket::MIN)).unwrap().into_raw_socket(),
|
||||
RawSocket::MIN
|
||||
);
|
||||
assert_eq!(
|
||||
Some(OwnedSocket::from_raw_socket(RawSocket::MAX)).unwrap().into_raw_socket(),
|
||||
RawSocket::MAX
|
||||
);
|
||||
#[cfg(target_pointer_size = "32")]
|
||||
let (min, max) = (i32::MIN as u32, i32::MAX as u32);
|
||||
#[cfg(target_pointer_size = "64")]
|
||||
let (min, max) = (i64::MIN as u64, i64::MAX as u64);
|
||||
|
||||
assert_eq!(OwnedSocket::from_raw_socket(min).into_raw_socket(), min);
|
||||
assert_eq!(OwnedSocket::from_raw_socket(max).into_raw_socket(), max);
|
||||
assert_eq!(Some(OwnedSocket::from_raw_socket(min)).unwrap().into_raw_socket(), min);
|
||||
assert_eq!(Some(OwnedSocket::from_raw_socket(max)).unwrap().into_raw_socket(), max);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user