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

[0.2] ci: Remove tests with rust < 1.63 #4051

Merged
merged 4 commits into from
Nov 16, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
MacOS: move ifconf to s_no_extra_traits
The derived implementations were causing a CI failure that didn't show
up before. Manually implement `PartialEq` and `Debug` to work around
this.
  • Loading branch information
tgross35 committed Nov 16, 2024
commit 6093ce044c3e2638523afcc3720db9b0851f4cb6
45 changes: 36 additions & 9 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1143,15 +1143,6 @@ s! {
pub nativeattr: attribute_set_t,
}

#[cfg_attr(libc_packedN, repr(packed(4)))]
pub struct ifconf {
pub ifc_len: ::c_int,
#[cfg(libc_union)]
pub ifc_ifcu: __c_anonymous_ifc_ifcu,
#[cfg(not(libc_union))]
pub ifc_ifcu: *mut ifreq,
}

#[cfg_attr(libc_align, repr(align(8)))]
pub struct tcp_connection_info {
pub tcpi_state: u8,
Expand Down Expand Up @@ -1202,6 +1193,15 @@ s! {
}

s_no_extra_traits! {
#[cfg_attr(libc_packedN, repr(packed(4)))]
pub struct ifconf {
pub ifc_len: ::c_int,
#[cfg(libc_union)]
pub ifc_ifcu: __c_anonymous_ifc_ifcu,
#[cfg(not(libc_union))]
pub ifc_ifcu: *mut ifreq,
}

#[cfg_attr(libc_packedN, repr(packed(4)))]
pub struct kevent {
pub ident: ::uintptr_t,
Expand Down Expand Up @@ -1617,6 +1617,32 @@ cfg_if! {

cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for ifconf
where
Self: Copy
{
fn eq(&self, other: &Self) -> bool {
let len_ptr1 = core::ptr::addr_of!(self.ifc_len);
let len_ptr2 = core::ptr::addr_of!(other.ifc_len);
let ifcu_ptr1 = core::ptr::addr_of!(self.ifc_ifcu);
let ifcu_ptr2 = core::ptr::addr_of!(other.ifc_ifcu);

// SAFETY: `ifconf` implements `Copy` so the reads are valid
let len1 = unsafe { len_ptr1.read_unaligned() };
let len2 = unsafe { len_ptr2.read_unaligned() };
let ifcu1 = unsafe { ifcu_ptr1.read_unaligned() };
let ifcu2 = unsafe { ifcu_ptr2.read_unaligned() };

len1 == len2 && ifcu1 == ifcu2
}
}
impl Eq for ifconf {}
impl ::fmt::Debug for ifconf {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("ifconf").finish_non_exhaustive()
}
}

impl PartialEq for kevent {
fn eq(&self, other: &kevent) -> bool {
self.ident == other.ident
Expand All @@ -1627,6 +1653,7 @@ cfg_if! {
&& self.udata == other.udata
}
}

impl Eq for kevent {}
impl ::fmt::Debug for kevent {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
Expand Down