Skip to content

Commit 72ba1f1

Browse files
committed
Revert "Fix nightly compiler complaints about size_of"
This reverts commit 50b41c7.
1 parent 50b41c7 commit 72ba1f1

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

Diff for: src/lib.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ mod sys;
1515
pub mod types;
1616

1717
use std::marker::PhantomData;
18-
use std::mem::size_of;
1918
use std::mem::ManuallyDrop;
2019
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
21-
use std::{cmp, io};
20+
use std::{cmp, io, mem};
2221

2322
#[cfg(feature = "io_safety")]
2423
use std::os::unix::io::{AsFd, BorrowedFd};
@@ -136,9 +135,9 @@ impl<S: squeue::EntryMarker, C: cqueue::EntryMarker> IoUring<S, C> {
136135
fd: &OwnedFd,
137136
p: &sys::io_uring_params,
138137
) -> io::Result<(MemoryMap, squeue::Inner<S>, cqueue::Inner<C>)> {
139-
let sq_len = p.sq_off.array as usize + p.sq_entries as usize * size_of::<u32>();
140-
let cq_len = p.cq_off.cqes as usize + p.cq_entries as usize * size_of::<C>();
141-
let sqe_len = p.sq_entries as usize * size_of::<S>();
138+
let sq_len = p.sq_off.array as usize + p.sq_entries as usize * mem::size_of::<u32>();
139+
let cq_len = p.cq_off.cqes as usize + p.cq_entries as usize * mem::size_of::<C>();
140+
let sqe_len = p.sq_entries as usize * mem::size_of::<S>();
142141
let sqe_mmap = Mmap::new(fd, sys::IORING_OFF_SQES as _, sqe_len)?;
143142

144143
if p.features & sys::IORING_FEAT_SINGLE_MMAP != 0 {

Diff for: src/opcode.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use std::convert::TryInto;
66
use std::mem;
7-
use std::mem::size_of;
87
use std::os::unix::io::RawFd;
98

109
use crate::squeue::Entry;
@@ -1107,7 +1106,7 @@ opcode! {
11071106
sqe.opcode = Self::CODE;
11081107
sqe.fd = dirfd;
11091108
sqe.__bindgen_anon_2.addr = pathname as _;
1110-
sqe.len = size_of::<sys::open_how>() as _;
1109+
sqe.len = mem::size_of::<sys::open_how>() as _;
11111110
sqe.__bindgen_anon_1.off = how as _;
11121111
if let Some(dest) = file_index {
11131112
sqe.__bindgen_anon_5.file_index = dest.kernel_index_arg();

Diff for: src/submit.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
use std::mem::size_of;
21
use std::os::unix::io::{AsRawFd, RawFd};
32
use std::sync::atomic;
4-
use std::{io, ptr};
3+
use std::{io, mem, ptr};
54

65
use crate::register::{execute, Probe};
76
use crate::sys;
@@ -92,7 +91,7 @@ impl<'a> Submitter<'a> {
9291
let arg = arg
9392
.map(|arg| cast_ptr(arg).cast())
9493
.unwrap_or_else(ptr::null);
95-
let size = size_of::<T>();
94+
let size = mem::size_of::<T>();
9695
sys::io_uring_enter(
9796
self.fd.as_raw_fd(),
9897
to_submit,
@@ -211,7 +210,7 @@ impl<'a> Submitter<'a> {
211210
self.fd.as_raw_fd(),
212211
sys::IORING_REGISTER_FILES2,
213212
cast_ptr::<sys::io_uring_rsrc_register>(&rr).cast(),
214-
size_of::<sys::io_uring_rsrc_register>() as _,
213+
mem::size_of::<sys::io_uring_rsrc_register>() as _,
215214
)
216215
.map(drop)
217216
}
@@ -412,7 +411,7 @@ impl<'a> Submitter<'a> {
412411
self.fd.as_raw_fd(),
413412
sys::IORING_REGISTER_IOWQ_AFF,
414413
cpu_set as *const _ as *const libc::c_void,
415-
size_of::<libc::cpu_set_t>() as u32,
414+
mem::size_of::<libc::cpu_set_t>() as u32,
416415
)
417416
.map(drop)
418417
}

Diff for: src/types.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Common Linux types not provided by libc.
22
3-
use std::mem::size_of;
4-
53
pub(crate) mod sealed {
64
use super::{Fd, Fixed};
75
use std::os::unix::io::RawFd;
@@ -252,7 +250,7 @@ impl<'prev, 'now> SubmitArgs<'prev, 'now> {
252250
#[inline]
253251
pub fn sigmask<'new>(mut self, sigmask: &'new libc::sigset_t) -> SubmitArgs<'now, 'new> {
254252
self.args.sigmask = cast_ptr(sigmask) as _;
255-
self.args.sigmask_sz = size_of::<libc::sigset_t>() as _;
253+
self.args.sigmask_sz = std::mem::size_of::<libc::sigset_t>() as _;
256254

257255
SubmitArgs {
258256
args: self.args,
@@ -387,7 +385,7 @@ pub struct RecvMsgOut<'buf> {
387385
}
388386

389387
impl<'buf> RecvMsgOut<'buf> {
390-
const DATA_START: usize = size_of::<sys::io_uring_recvmsg_out>();
388+
const DATA_START: usize = std::mem::size_of::<sys::io_uring_recvmsg_out>();
391389

392390
/// Parse the data buffered upon completion of a `RecvMsg` multishot operation.
393391
///

0 commit comments

Comments
 (0)