Skip to content

Commit 318319c

Browse files
committed
Add core::mem::{size_of, align_of} to the prelude
Since 1.80 these, along with their `_val` versions, are in the default `core` prelude so they don't need to be imported. 1.80 exceeds our MSRV so we can't use it from there, but we can add it to our prelude for now. (backport <#4532>) (cherry picked from commit 26a5ea6)
1 parent c965135 commit 318319c

47 files changed

Lines changed: 226 additions & 270 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/fuchsia/mod.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3250,20 +3250,20 @@ cfg_if! {
32503250
f! {
32513251
pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () {
32523252
let fd = fd as usize;
3253-
let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
3253+
let size = size_of_val(&(*set).fds_bits[0]) * 8;
32543254
(*set).fds_bits[fd / size] &= !(1 << (fd % size));
32553255
return;
32563256
}
32573257

32583258
pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool {
32593259
let fd = fd as usize;
3260-
let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
3260+
let size = size_of_val(&(*set).fds_bits[0]) * 8;
32613261
return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0;
32623262
}
32633263

32643264
pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () {
32653265
let fd = fd as usize;
3266-
let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
3266+
let size = size_of_val(&(*set).fds_bits[0]) * 8;
32673267
(*set).fds_bits[fd / size] |= 1 << (fd % size);
32683268
return;
32693269
}
@@ -3281,21 +3281,21 @@ f! {
32813281
}
32823282

32833283
pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
3284-
let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
3284+
let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc
32853285
let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
32863286
cpuset.bits[idx] |= 1 << offset;
32873287
()
32883288
}
32893289

32903290
pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
3291-
let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
3291+
let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc
32923292
let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
32933293
cpuset.bits[idx] &= !(1 << offset);
32943294
()
32953295
}
32963296

32973297
pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
3298-
let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]);
3298+
let size_in_bits = 8 * size_of_val(&cpuset.bits[0]);
32993299
let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
33003300
0 != (cpuset.bits[idx] & (1 << offset))
33013301
}
@@ -3309,33 +3309,33 @@ f! {
33093309
}
33103310

33113311
pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
3312-
if ((*cmsg).cmsg_len as size_t) < mem::size_of::<cmsghdr>() {
3312+
if ((*cmsg).cmsg_len as size_t) < size_of::<cmsghdr>() {
33133313
core::ptr::null_mut::<cmsghdr>()
3314-
} else if __CMSG_NEXT(cmsg).add(mem::size_of::<cmsghdr>()) >= __MHDR_END(mhdr) {
3314+
} else if __CMSG_NEXT(cmsg).add(size_of::<cmsghdr>()) >= __MHDR_END(mhdr) {
33153315
core::ptr::null_mut::<cmsghdr>()
33163316
} else {
33173317
__CMSG_NEXT(cmsg).cast()
33183318
}
33193319
}
33203320

33213321
pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
3322-
if (*mhdr).msg_controllen as size_t >= mem::size_of::<cmsghdr>() {
3322+
if (*mhdr).msg_controllen as size_t >= size_of::<cmsghdr>() {
33233323
(*mhdr).msg_control.cast()
33243324
} else {
33253325
core::ptr::null_mut::<cmsghdr>()
33263326
}
33273327
}
33283328

33293329
pub {const} fn CMSG_ALIGN(len: size_t) -> size_t {
3330-
(len + mem::size_of::<size_t>() - 1) & !(mem::size_of::<size_t>() - 1)
3330+
(len + size_of::<size_t>() - 1) & !(size_of::<size_t>() - 1)
33313331
}
33323332

33333333
pub {const} fn CMSG_SPACE(len: c_uint) -> c_uint {
3334-
(CMSG_ALIGN(len as size_t) + CMSG_ALIGN(mem::size_of::<cmsghdr>())) as c_uint
3334+
(CMSG_ALIGN(len as size_t) + CMSG_ALIGN(size_of::<cmsghdr>())) as c_uint
33353335
}
33363336

33373337
pub {const} fn CMSG_LEN(len: c_uint) -> c_uint {
3338-
(CMSG_ALIGN(mem::size_of::<cmsghdr>()) + len as size_t) as c_uint
3338+
(CMSG_ALIGN(size_of::<cmsghdr>()) + len as size_t) as c_uint
33393339
}
33403340
}
33413341

@@ -3403,8 +3403,8 @@ safe_f! {
34033403
}
34043404

34053405
fn __CMSG_LEN(cmsg: *const cmsghdr) -> ssize_t {
3406-
((unsafe { (*cmsg).cmsg_len as size_t } + mem::size_of::<c_long>() - 1)
3407-
& !(mem::size_of::<c_long>() - 1)) as ssize_t
3406+
((unsafe { (*cmsg).cmsg_len as size_t } + size_of::<c_long>() - 1) & !(size_of::<c_long>() - 1))
3407+
as ssize_t
34083408
}
34093409

34103410
fn __CMSG_NEXT(cmsg: *const cmsghdr) -> *mut c_uchar {

src/macros.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ macro_rules! prelude {
7777
pub(crate) use ::core::option::Option;
7878
#[allow(unused_imports)]
7979
pub(crate) use ::core::{fmt, hash, iter, mem};
80+
#[allow(unused_imports)]
81+
pub(crate) use mem::{align_of, align_of_val, size_of, size_of_val};
8082

8183
// Commonly used types defined in this crate
8284
#[allow(unused_imports)]

src/primitives.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,16 @@ cfg_if! {
151151
// // catch the fact that llvm and gcc disagree on how x64 __int128
152152
// // is actually *passed* on the stack (clang underaligns it for
153153
// // the same reason that rustc *never* properly aligns it).
154-
// static_assert_eq!(core::mem::size_of::<__int128>(), _SIZE_128);
155-
// static_assert_eq!(core::mem::align_of::<__int128>(), _ALIGN_128);
154+
// static_assert_eq!(size_of::<__int128>(), _SIZE_128);
155+
// static_assert_eq!(align_of::<__int128>(), _ALIGN_128);
156156

157-
// static_assert_eq!(core::mem::size_of::<__uint128>(), _SIZE_128);
158-
// static_assert_eq!(core::mem::align_of::<__uint128>(), _ALIGN_128);
157+
// static_assert_eq!(size_of::<__uint128>(), _SIZE_128);
158+
// static_assert_eq!(align_of::<__uint128>(), _ALIGN_128);
159159

160-
// static_assert_eq!(core::mem::size_of::<__int128_t>(), _SIZE_128);
161-
// static_assert_eq!(core::mem::align_of::<__int128_t>(), _ALIGN_128);
160+
// static_assert_eq!(size_of::<__int128_t>(), _SIZE_128);
161+
// static_assert_eq!(align_of::<__int128_t>(), _ALIGN_128);
162162

163-
// static_assert_eq!(core::mem::size_of::<__uint128_t>(), _SIZE_128);
164-
// static_assert_eq!(core::mem::align_of::<__uint128_t>(), _ALIGN_128);
163+
// static_assert_eq!(size_of::<__uint128_t>(), _SIZE_128);
164+
// static_assert_eq!(align_of::<__uint128_t>(), _ALIGN_128);
165165
}
166166
}

src/teeos/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub struct pthread_attr_t {
9999

100100
#[repr(C)]
101101
pub struct cpu_set_t {
102-
bits: [c_ulong; 128 / core::mem::size_of::<c_ulong>()],
102+
bits: [c_ulong; 128 / size_of::<c_ulong>()],
103103
}
104104

105105
#[repr(C)]
@@ -137,7 +137,7 @@ pub struct mbstate_t {
137137

138138
#[repr(C)]
139139
pub struct sem_t {
140-
pub __val: [c_int; 4 * core::mem::size_of::<c_long>() / core::mem::size_of::<c_int>()],
140+
pub __val: [c_int; 4 * size_of::<c_long>() / size_of::<c_int>()],
141141
}
142142

143143
#[repr(C)]
@@ -1342,7 +1342,7 @@ pub fn errno() -> c_int {
13421342

13431343
pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int {
13441344
let mut s: u32 = 0;
1345-
let size_of_mask = core::mem::size_of_val(&cpuset.bits[0]);
1345+
let size_of_mask = size_of_val(&cpuset.bits[0]);
13461346

13471347
for i in cpuset.bits[..(size / size_of_mask)].iter() {
13481348
s += i.count_ones();
@@ -1351,5 +1351,5 @@ pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int {
13511351
}
13521352

13531353
pub fn CPU_COUNT(cpuset: &cpu_set_t) -> c_int {
1354-
CPU_COUNT_S(core::mem::size_of::<cpu_set_t>(), cpuset)
1354+
CPU_COUNT_S(size_of::<cpu_set_t>(), cpuset)
13551355
}

src/unix/aix/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,7 +2434,7 @@ pub const ACCOUNTING: c_short = 9;
24342434

24352435
f! {
24362436
pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
2437-
if (*mhdr).msg_controllen as usize >= mem::size_of::<cmsghdr>() {
2437+
if (*mhdr).msg_controllen as usize >= size_of::<cmsghdr>() {
24382438
(*mhdr).msg_control as *mut cmsghdr
24392439
} else {
24402440
core::ptr::null_mut::<cmsghdr>()
@@ -2445,7 +2445,7 @@ f! {
24452445
if cmsg.is_null() {
24462446
CMSG_FIRSTHDR(mhdr)
24472447
} else {
2448-
if (cmsg as usize + (*cmsg).cmsg_len as usize + mem::size_of::<cmsghdr>())
2448+
if (cmsg as usize + (*cmsg).cmsg_len as usize + size_of::<cmsghdr>())
24492449
> ((*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize)
24502450
{
24512451
core::ptr::null_mut::<cmsghdr>()
@@ -2457,15 +2457,15 @@ f! {
24572457
}
24582458

24592459
pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
2460-
(cmsg as *mut c_uchar).offset(mem::size_of::<cmsghdr>() as isize)
2460+
(cmsg as *mut c_uchar).offset(size_of::<cmsghdr>() as isize)
24612461
}
24622462

24632463
pub {const} fn CMSG_LEN(length: c_uint) -> c_uint {
2464-
mem::size_of::<cmsghdr>() as c_uint + length
2464+
size_of::<cmsghdr>() as c_uint + length
24652465
}
24662466

24672467
pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint {
2468-
mem::size_of::<cmsghdr>() as c_uint + length
2468+
size_of::<cmsghdr>() as c_uint + length
24692469
}
24702470

24712471
pub fn FD_ZERO(set: *mut fd_set) -> () {
@@ -2475,21 +2475,21 @@ f! {
24752475
}
24762476

24772477
pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () {
2478-
let bits = mem::size_of::<c_long>() * 8;
2478+
let bits = size_of::<c_long>() * 8;
24792479
let fd = fd as usize;
24802480
(*set).fds_bits[fd / bits] |= 1 << (fd % bits);
24812481
return;
24822482
}
24832483

24842484
pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () {
2485-
let bits = mem::size_of::<c_long>() * 8;
2485+
let bits = size_of::<c_long>() * 8;
24862486
let fd = fd as usize;
24872487
(*set).fds_bits[fd / bits] &= !(1 << (fd % bits));
24882488
return;
24892489
}
24902490

24912491
pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool {
2492-
let bits = mem::size_of::<c_long>() * 8;
2492+
let bits = size_of::<c_long>() * 8;
24932493
let fd = fd as usize;
24942494
return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0;
24952495
}

src/unix/bsd/apple/mod.rs

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4642,7 +4642,7 @@ pub const PROC_PIDVNODEPATHINFO: c_int = 9;
46424642
pub const PROC_PIDPATHINFO_MAXSIZE: c_int = 4096;
46434643

46444644
pub const PROC_PIDLISTFDS: c_int = 1;
4645-
pub const PROC_PIDLISTFD_SIZE: c_int = mem::size_of::<proc_fdinfo>() as c_int;
4645+
pub const PROC_PIDLISTFD_SIZE: c_int = size_of::<proc_fdinfo>() as c_int;
46464646
pub const PROX_FDTYPE_ATALK: c_int = 0;
46474647
pub const PROX_FDTYPE_VNODE: c_int = 1;
46484648
pub const PROX_FDTYPE_SOCKET: c_int = 2;
@@ -5129,48 +5129,42 @@ pub const VMADDR_CID_HOST: c_uint = 2;
51295129
pub const VMADDR_PORT_ANY: c_uint = 0xFFFFFFFF;
51305130

51315131
const fn __DARWIN_ALIGN32(p: usize) -> usize {
5132-
const __DARWIN_ALIGNBYTES32: usize = mem::size_of::<u32>() - 1;
5132+
const __DARWIN_ALIGNBYTES32: usize = size_of::<u32>() - 1;
51335133
(p + __DARWIN_ALIGNBYTES32) & !__DARWIN_ALIGNBYTES32
51345134
}
51355135

51365136
pub const THREAD_EXTENDED_POLICY_COUNT: mach_msg_type_number_t =
5137-
(mem::size_of::<thread_extended_policy_data_t>() / mem::size_of::<integer_t>())
5138-
as mach_msg_type_number_t;
5137+
(size_of::<thread_extended_policy_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
51395138
pub const THREAD_TIME_CONSTRAINT_POLICY_COUNT: mach_msg_type_number_t =
5140-
(mem::size_of::<thread_time_constraint_policy_data_t>() / mem::size_of::<integer_t>())
5139+
(size_of::<thread_time_constraint_policy_data_t>() / size_of::<integer_t>())
51415140
as mach_msg_type_number_t;
51425141
pub const THREAD_PRECEDENCE_POLICY_COUNT: mach_msg_type_number_t =
5143-
(mem::size_of::<thread_precedence_policy_data_t>() / mem::size_of::<integer_t>())
5142+
(size_of::<thread_precedence_policy_data_t>() / size_of::<integer_t>())
51445143
as mach_msg_type_number_t;
51455144
pub const THREAD_AFFINITY_POLICY_COUNT: mach_msg_type_number_t =
5146-
(mem::size_of::<thread_affinity_policy_data_t>() / mem::size_of::<integer_t>())
5147-
as mach_msg_type_number_t;
5145+
(size_of::<thread_affinity_policy_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
51485146
pub const THREAD_BACKGROUND_POLICY_COUNT: mach_msg_type_number_t =
5149-
(mem::size_of::<thread_background_policy_data_t>() / mem::size_of::<integer_t>())
5147+
(size_of::<thread_background_policy_data_t>() / size_of::<integer_t>())
51505148
as mach_msg_type_number_t;
51515149
pub const THREAD_LATENCY_QOS_POLICY_COUNT: mach_msg_type_number_t =
5152-
(mem::size_of::<thread_latency_qos_policy_data_t>() / mem::size_of::<integer_t>())
5150+
(size_of::<thread_latency_qos_policy_data_t>() / size_of::<integer_t>())
51535151
as mach_msg_type_number_t;
51545152
pub const THREAD_THROUGHPUT_QOS_POLICY_COUNT: mach_msg_type_number_t =
5155-
(mem::size_of::<thread_throughput_qos_policy_data_t>() / mem::size_of::<integer_t>())
5153+
(size_of::<thread_throughput_qos_policy_data_t>() / size_of::<integer_t>())
51565154
as mach_msg_type_number_t;
51575155
pub const THREAD_BASIC_INFO_COUNT: mach_msg_type_number_t =
5158-
(mem::size_of::<thread_basic_info_data_t>() / mem::size_of::<integer_t>())
5159-
as mach_msg_type_number_t;
5156+
(size_of::<thread_basic_info_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
51605157
pub const THREAD_IDENTIFIER_INFO_COUNT: mach_msg_type_number_t =
5161-
(mem::size_of::<thread_identifier_info_data_t>() / mem::size_of::<integer_t>())
5162-
as mach_msg_type_number_t;
5158+
(size_of::<thread_identifier_info_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
51635159
pub const THREAD_EXTENDED_INFO_COUNT: mach_msg_type_number_t =
5164-
(mem::size_of::<thread_extended_info_data_t>() / mem::size_of::<integer_t>())
5165-
as mach_msg_type_number_t;
5160+
(size_of::<thread_extended_info_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
51665161

51675162
pub const TASK_THREAD_TIMES_INFO_COUNT: u32 =
5168-
(mem::size_of::<task_thread_times_info_data_t>() / mem::size_of::<natural_t>()) as u32;
5163+
(size_of::<task_thread_times_info_data_t>() / size_of::<natural_t>()) as u32;
51695164
pub const MACH_TASK_BASIC_INFO_COUNT: u32 =
5170-
(mem::size_of::<mach_task_basic_info_data_t>() / mem::size_of::<natural_t>()) as u32;
5171-
pub const HOST_VM_INFO64_COUNT: mach_msg_type_number_t = (mem::size_of::<vm_statistics64_data_t>()
5172-
/ mem::size_of::<integer_t>())
5173-
as mach_msg_type_number_t;
5165+
(size_of::<mach_task_basic_info_data_t>() / size_of::<natural_t>()) as u32;
5166+
pub const HOST_VM_INFO64_COUNT: mach_msg_type_number_t =
5167+
(size_of::<vm_statistics64_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
51745168

51755169
// bsd/net/if_mib.h
51765170
/// Non-interface-specific
@@ -5209,23 +5203,23 @@ f! {
52095203
let cmsg_len = (*cmsg).cmsg_len as usize;
52105204
let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len);
52115205
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
5212-
if next + __DARWIN_ALIGN32(mem::size_of::<cmsghdr>()) > max {
5206+
if next + __DARWIN_ALIGN32(size_of::<cmsghdr>()) > max {
52135207
core::ptr::null_mut()
52145208
} else {
52155209
next as *mut cmsghdr
52165210
}
52175211
}
52185212

52195213
pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
5220-
(cmsg as *mut c_uchar).add(__DARWIN_ALIGN32(mem::size_of::<cmsghdr>()))
5214+
(cmsg as *mut c_uchar).add(__DARWIN_ALIGN32(size_of::<cmsghdr>()))
52215215
}
52225216

52235217
pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint {
5224-
(__DARWIN_ALIGN32(mem::size_of::<cmsghdr>()) + __DARWIN_ALIGN32(length as usize)) as c_uint
5218+
(__DARWIN_ALIGN32(size_of::<cmsghdr>()) + __DARWIN_ALIGN32(length as usize)) as c_uint
52255219
}
52265220

52275221
pub {const} fn CMSG_LEN(length: c_uint) -> c_uint {
5228-
(__DARWIN_ALIGN32(mem::size_of::<cmsghdr>()) + length as usize) as c_uint
5222+
(__DARWIN_ALIGN32(size_of::<cmsghdr>()) + length as usize) as c_uint
52295223
}
52305224

52315225
pub {const} fn VM_MAKE_TAG(id: u8) -> u32 {

src/unix/bsd/freebsdlike/dragonfly/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ pub const CPUCTL_MSRSBIT: c_int = 0xc0106305;
949949
pub const CPUCTL_MSRCBIT: c_int = 0xc0106306;
950950
pub const CPUCTL_CPUID_COUNT: c_int = 0xc0106307;
951951

952-
pub const CPU_SETSIZE: size_t = mem::size_of::<crate::cpumask_t>() * 8;
952+
pub const CPU_SETSIZE: size_t = size_of::<crate::cpumask_t>() * 8;
953953

954954
pub const EVFILT_READ: i16 = -1;
955955
pub const EVFILT_WRITE: i16 = -2;
@@ -1421,23 +1421,23 @@ pub const RTAX_MAX: c_int = 11;
14211421

14221422
const_fn! {
14231423
{const} fn _CMSG_ALIGN(n: usize) -> usize {
1424-
(n + (mem::size_of::<c_long>() - 1)) & !(mem::size_of::<c_long>() - 1)
1424+
(n + (size_of::<c_long>() - 1)) & !(size_of::<c_long>() - 1)
14251425
}
14261426
}
14271427

14281428
f! {
14291429
pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
1430-
(cmsg as *mut c_uchar).offset(_CMSG_ALIGN(mem::size_of::<cmsghdr>()) as isize)
1430+
(cmsg as *mut c_uchar).offset(_CMSG_ALIGN(size_of::<cmsghdr>()) as isize)
14311431
}
14321432

14331433
pub {const} fn CMSG_LEN(length: c_uint) -> c_uint {
1434-
(_CMSG_ALIGN(mem::size_of::<cmsghdr>()) + length as usize) as c_uint
1434+
(_CMSG_ALIGN(size_of::<cmsghdr>()) + length as usize) as c_uint
14351435
}
14361436

14371437
pub fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
14381438
let next = cmsg as usize
14391439
+ _CMSG_ALIGN((*cmsg).cmsg_len as usize)
1440-
+ _CMSG_ALIGN(mem::size_of::<cmsghdr>());
1440+
+ _CMSG_ALIGN(size_of::<cmsghdr>());
14411441
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
14421442
if next <= max {
14431443
(cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr
@@ -1447,7 +1447,7 @@ f! {
14471447
}
14481448

14491449
pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint {
1450-
(_CMSG_ALIGN(mem::size_of::<cmsghdr>()) + _CMSG_ALIGN(length as usize)) as c_uint
1450+
(_CMSG_ALIGN(size_of::<cmsghdr>()) + _CMSG_ALIGN(length as usize)) as c_uint
14511451
}
14521452

14531453
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {

src/unix/bsd/freebsdlike/freebsd/aarch64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ s_no_extra_traits! {
3333
}
3434
}
3535

36-
pub(crate) const _ALIGNBYTES: usize = mem::size_of::<c_longlong>() - 1;
36+
pub(crate) const _ALIGNBYTES: usize = size_of::<c_longlong>() - 1;
3737

3838
cfg_if! {
3939
if #[cfg(feature = "extra_traits")] {

src/unix/bsd/freebsdlike/freebsd/arm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ cfg_if! {
4343
}
4444
}
4545

46-
pub(crate) const _ALIGNBYTES: usize = mem::size_of::<c_int>() - 1;
46+
pub(crate) const _ALIGNBYTES: usize = size_of::<c_int>() - 1;
4747

4848
pub const BIOCSRTIMEOUT: c_ulong = 0x8010426d;
4949
pub const BIOCGRTIMEOUT: c_ulong = 0x4010426e;

0 commit comments

Comments
 (0)