Skip to content

Commit dce77be

Browse files
authored
Merge pull request #4532 from tgross35/prelude-size-align
Add `core::mem::{size_of, align_of}` to the prelude
2 parents dc4c75d + 26a5ea6 commit dce77be

File tree

48 files changed

+227
-271
lines changed

Some content is hidden

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

48 files changed

+227
-271
lines changed

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
@@ -160,17 +160,17 @@ cfg_if! {
160160
// // catch the fact that llvm and gcc disagree on how x64 __int128
161161
// // is actually *passed* on the stack (clang underaligns it for
162162
// // the same reason that rustc *never* properly aligns it).
163-
// static_assert_eq!(core::mem::size_of::<__int128>(), _SIZE_128);
164-
// static_assert_eq!(core::mem::align_of::<__int128>(), _ALIGN_128);
163+
// static_assert_eq!(size_of::<__int128>(), _SIZE_128);
164+
// static_assert_eq!(align_of::<__int128>(), _ALIGN_128);
165165

166-
// static_assert_eq!(core::mem::size_of::<__uint128>(), _SIZE_128);
167-
// static_assert_eq!(core::mem::align_of::<__uint128>(), _ALIGN_128);
166+
// static_assert_eq!(size_of::<__uint128>(), _SIZE_128);
167+
// static_assert_eq!(align_of::<__uint128>(), _ALIGN_128);
168168

169-
// static_assert_eq!(core::mem::size_of::<__int128_t>(), _SIZE_128);
170-
// static_assert_eq!(core::mem::align_of::<__int128_t>(), _ALIGN_128);
169+
// static_assert_eq!(size_of::<__int128_t>(), _SIZE_128);
170+
// static_assert_eq!(align_of::<__int128_t>(), _ALIGN_128);
171171

172-
// static_assert_eq!(core::mem::size_of::<__uint128_t>(), _SIZE_128);
173-
// static_assert_eq!(core::mem::align_of::<__uint128_t>(), _ALIGN_128);
172+
// static_assert_eq!(size_of::<__uint128_t>(), _SIZE_128);
173+
// static_assert_eq!(align_of::<__uint128_t>(), _ALIGN_128);
174174
} else if #[cfg(all(
175175
target_arch = "aarch64",
176176
any(

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
@@ -2433,7 +2433,7 @@ pub const ACCOUNTING: c_short = 9;
24332433

24342434
f! {
24352435
pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
2436-
if (*mhdr).msg_controllen as usize >= mem::size_of::<cmsghdr>() {
2436+
if (*mhdr).msg_controllen as usize >= size_of::<cmsghdr>() {
24372437
(*mhdr).msg_control as *mut cmsghdr
24382438
} else {
24392439
core::ptr::null_mut::<cmsghdr>()
@@ -2444,7 +2444,7 @@ f! {
24442444
if cmsg.is_null() {
24452445
CMSG_FIRSTHDR(mhdr)
24462446
} else {
2447-
if (cmsg as usize + (*cmsg).cmsg_len as usize + mem::size_of::<cmsghdr>())
2447+
if (cmsg as usize + (*cmsg).cmsg_len as usize + size_of::<cmsghdr>())
24482448
> ((*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize)
24492449
{
24502450
core::ptr::null_mut::<cmsghdr>()
@@ -2456,15 +2456,15 @@ f! {
24562456
}
24572457

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

24622462
pub {const} fn CMSG_LEN(length: c_uint) -> c_uint {
2463-
mem::size_of::<cmsghdr>() as c_uint + length
2463+
size_of::<cmsghdr>() as c_uint + length
24642464
}
24652465

24662466
pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint {
2467-
mem::size_of::<cmsghdr>() as c_uint + length
2467+
size_of::<cmsghdr>() as c_uint + length
24682468
}
24692469

24702470
pub fn FD_ZERO(set: *mut fd_set) -> () {
@@ -2474,21 +2474,21 @@ f! {
24742474
}
24752475

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

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

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

src/unix/bsd/apple/mod.rs

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

44724472
pub const PROC_PIDLISTFDS: c_int = 1;
4473-
pub const PROC_PIDLISTFD_SIZE: c_int = mem::size_of::<proc_fdinfo>() as c_int;
4473+
pub const PROC_PIDLISTFD_SIZE: c_int = size_of::<proc_fdinfo>() as c_int;
44744474
pub const PROX_FDTYPE_ATALK: c_int = 0;
44754475
pub const PROX_FDTYPE_VNODE: c_int = 1;
44764476
pub const PROX_FDTYPE_SOCKET: c_int = 2;
@@ -4956,48 +4956,42 @@ pub const VMADDR_CID_HOST: c_uint = 2;
49564956
pub const VMADDR_PORT_ANY: c_uint = 0xFFFFFFFF;
49574957

49584958
const fn __DARWIN_ALIGN32(p: usize) -> usize {
4959-
const __DARWIN_ALIGNBYTES32: usize = mem::size_of::<u32>() - 1;
4959+
const __DARWIN_ALIGNBYTES32: usize = size_of::<u32>() - 1;
49604960
(p + __DARWIN_ALIGNBYTES32) & !__DARWIN_ALIGNBYTES32
49614961
}
49624962

49634963
pub const THREAD_EXTENDED_POLICY_COUNT: mach_msg_type_number_t =
4964-
(mem::size_of::<thread_extended_policy_data_t>() / mem::size_of::<integer_t>())
4965-
as mach_msg_type_number_t;
4964+
(size_of::<thread_extended_policy_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
49664965
pub const THREAD_TIME_CONSTRAINT_POLICY_COUNT: mach_msg_type_number_t =
4967-
(mem::size_of::<thread_time_constraint_policy_data_t>() / mem::size_of::<integer_t>())
4966+
(size_of::<thread_time_constraint_policy_data_t>() / size_of::<integer_t>())
49684967
as mach_msg_type_number_t;
49694968
pub const THREAD_PRECEDENCE_POLICY_COUNT: mach_msg_type_number_t =
4970-
(mem::size_of::<thread_precedence_policy_data_t>() / mem::size_of::<integer_t>())
4969+
(size_of::<thread_precedence_policy_data_t>() / size_of::<integer_t>())
49714970
as mach_msg_type_number_t;
49724971
pub const THREAD_AFFINITY_POLICY_COUNT: mach_msg_type_number_t =
4973-
(mem::size_of::<thread_affinity_policy_data_t>() / mem::size_of::<integer_t>())
4974-
as mach_msg_type_number_t;
4972+
(size_of::<thread_affinity_policy_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
49754973
pub const THREAD_BACKGROUND_POLICY_COUNT: mach_msg_type_number_t =
4976-
(mem::size_of::<thread_background_policy_data_t>() / mem::size_of::<integer_t>())
4974+
(size_of::<thread_background_policy_data_t>() / size_of::<integer_t>())
49774975
as mach_msg_type_number_t;
49784976
pub const THREAD_LATENCY_QOS_POLICY_COUNT: mach_msg_type_number_t =
4979-
(mem::size_of::<thread_latency_qos_policy_data_t>() / mem::size_of::<integer_t>())
4977+
(size_of::<thread_latency_qos_policy_data_t>() / size_of::<integer_t>())
49804978
as mach_msg_type_number_t;
49814979
pub const THREAD_THROUGHPUT_QOS_POLICY_COUNT: mach_msg_type_number_t =
4982-
(mem::size_of::<thread_throughput_qos_policy_data_t>() / mem::size_of::<integer_t>())
4980+
(size_of::<thread_throughput_qos_policy_data_t>() / size_of::<integer_t>())
49834981
as mach_msg_type_number_t;
49844982
pub const THREAD_BASIC_INFO_COUNT: mach_msg_type_number_t =
4985-
(mem::size_of::<thread_basic_info_data_t>() / mem::size_of::<integer_t>())
4986-
as mach_msg_type_number_t;
4983+
(size_of::<thread_basic_info_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
49874984
pub const THREAD_IDENTIFIER_INFO_COUNT: mach_msg_type_number_t =
4988-
(mem::size_of::<thread_identifier_info_data_t>() / mem::size_of::<integer_t>())
4989-
as mach_msg_type_number_t;
4985+
(size_of::<thread_identifier_info_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
49904986
pub const THREAD_EXTENDED_INFO_COUNT: mach_msg_type_number_t =
4991-
(mem::size_of::<thread_extended_info_data_t>() / mem::size_of::<integer_t>())
4992-
as mach_msg_type_number_t;
4987+
(size_of::<thread_extended_info_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
49934988

49944989
pub const TASK_THREAD_TIMES_INFO_COUNT: u32 =
4995-
(mem::size_of::<task_thread_times_info_data_t>() / mem::size_of::<natural_t>()) as u32;
4990+
(size_of::<task_thread_times_info_data_t>() / size_of::<natural_t>()) as u32;
49964991
pub const MACH_TASK_BASIC_INFO_COUNT: u32 =
4997-
(mem::size_of::<mach_task_basic_info_data_t>() / mem::size_of::<natural_t>()) as u32;
4998-
pub const HOST_VM_INFO64_COUNT: mach_msg_type_number_t = (mem::size_of::<vm_statistics64_data_t>()
4999-
/ mem::size_of::<integer_t>())
5000-
as mach_msg_type_number_t;
4992+
(size_of::<mach_task_basic_info_data_t>() / size_of::<natural_t>()) as u32;
4993+
pub const HOST_VM_INFO64_COUNT: mach_msg_type_number_t =
4994+
(size_of::<vm_statistics64_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
50014995

50024996
// bsd/net/if_mib.h
50034997
/// Non-interface-specific
@@ -5036,23 +5030,23 @@ f! {
50365030
let cmsg_len = (*cmsg).cmsg_len as usize;
50375031
let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len);
50385032
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
5039-
if next + __DARWIN_ALIGN32(mem::size_of::<cmsghdr>()) > max {
5033+
if next + __DARWIN_ALIGN32(size_of::<cmsghdr>()) > max {
50405034
core::ptr::null_mut()
50415035
} else {
50425036
next as *mut cmsghdr
50435037
}
50445038
}
50455039

50465040
pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
5047-
(cmsg as *mut c_uchar).add(__DARWIN_ALIGN32(mem::size_of::<cmsghdr>()))
5041+
(cmsg as *mut c_uchar).add(__DARWIN_ALIGN32(size_of::<cmsghdr>()))
50485042
}
50495043

50505044
pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint {
5051-
(__DARWIN_ALIGN32(mem::size_of::<cmsghdr>()) + __DARWIN_ALIGN32(length as usize)) as c_uint
5045+
(__DARWIN_ALIGN32(size_of::<cmsghdr>()) + __DARWIN_ALIGN32(length as usize)) as c_uint
50525046
}
50535047

50545048
pub {const} fn CMSG_LEN(length: c_uint) -> c_uint {
5055-
(__DARWIN_ALIGN32(mem::size_of::<cmsghdr>()) + length as usize) as c_uint
5049+
(__DARWIN_ALIGN32(size_of::<cmsghdr>()) + length as usize) as c_uint
50565050
}
50575051

50585052
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)