Skip to content

Commit 2f3c4aa

Browse files
tgross35AkhilTThomas
authored andcommitted
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.
1 parent 7594935 commit 2f3c4aa

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/unix/bsd/apple/mod.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,6 +1694,32 @@ cfg_if! {
16941694

16951695
cfg_if! {
16961696
if #[cfg(feature = "extra_traits")] {
1697+
impl PartialEq for ifconf
1698+
where
1699+
Self: Copy
1700+
{
1701+
fn eq(&self, other: &Self) -> bool {
1702+
let len_ptr1 = core::ptr::addr_of!(self.ifc_len);
1703+
let len_ptr2 = core::ptr::addr_of!(other.ifc_len);
1704+
let ifcu_ptr1 = core::ptr::addr_of!(self.ifc_ifcu);
1705+
let ifcu_ptr2 = core::ptr::addr_of!(other.ifc_ifcu);
1706+
1707+
// SAFETY: `ifconf` implements `Copy` so the reads are valid
1708+
let len1 = unsafe { len_ptr1.read_unaligned() };
1709+
let len2 = unsafe { len_ptr2.read_unaligned() };
1710+
let ifcu1 = unsafe { ifcu_ptr1.read_unaligned() };
1711+
let ifcu2 = unsafe { ifcu_ptr2.read_unaligned() };
1712+
1713+
len1 == len2 && ifcu1 == ifcu2
1714+
}
1715+
}
1716+
impl Eq for ifconf {}
1717+
impl ::fmt::Debug for ifconf {
1718+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1719+
f.debug_struct("ifconf").finish_non_exhaustive()
1720+
}
1721+
}
1722+
16971723
impl PartialEq for kevent {
16981724
fn eq(&self, other: &kevent) -> bool {
16991725
self.ident == other.ident
@@ -1704,6 +1730,7 @@ cfg_if! {
17041730
&& self.udata == other.udata
17051731
}
17061732
}
1733+
17071734
impl Eq for kevent {}
17081735
impl fmt::Debug for kevent {
17091736
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

0 commit comments

Comments
 (0)