summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-13 21:34:54 +0000
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-13 21:34:54 +0000
commit96ae786550c983eb82b4c060fd323c4855fbb311 (patch)
tree606b541c9d842fd759c5978a9efa499dc4c4feee /src
parent4978a382ee343108bf89173704c030f7cdf12a38 (diff)
parent2373ac817f331991d12dd0d1bccb20bb69300f6e (diff)
downloadnix-96ae786550c983eb82b4c060fd323c4855fbb311.zip
Merge #1095
1095: Fix warnings on Rust 1.37.0 r=asomers a=asomers * Replace obsolete range syntax "..." with inclusive range "..=" * Use dyn Trait syntax instead of Box<Trait> * Raise MSRV to 1.27.0 (for dyn Trait syntax) * Test with nightly again Co-authored-by: Alan Somers <asomers@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/features.rs2
-rw-r--r--src/lib.rs2
-rw-r--r--src/sched.rs4
-rw-r--r--src/sys/aio.rs24
-rw-r--r--src/sys/socket/mod.rs2
5 files changed, 18 insertions, 16 deletions
diff --git a/src/features.rs b/src/features.rs
index 7797aa46..76cdfd3a 100644
--- a/src/features.rs
+++ b/src/features.rs
@@ -39,7 +39,7 @@ mod os {
b'.' | b'-' => {
curr += 1;
}
- b'0'...b'9' => {
+ b'0'..=b'9' => {
match curr {
0 => digit(&mut major, b),
1 => digit(&mut minor, b),
diff --git a/src/lib.rs b/src/lib.rs
index 22577cfe..71485d2a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -14,6 +14,8 @@
#![deny(unstable_features)]
#![deny(missing_copy_implementations)]
#![deny(missing_debug_implementations)]
+// XXX Allow deprecated items until release 0.16.0. See issue #1096.
+#![allow(deprecated)]
// External crates
#[macro_use]
diff --git a/src/sched.rs b/src/sched.rs
index 064fc29d..67188c57 100644
--- a/src/sched.rs
+++ b/src/sched.rs
@@ -44,7 +44,7 @@ mod sched_linux_like {
}
}
- pub type CloneCb<'a> = Box<FnMut() -> isize + 'a>;
+ pub type CloneCb<'a> = Box<dyn FnMut() -> isize + 'a>;
#[repr(C)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
@@ -113,7 +113,7 @@ mod sched_linux_like {
let ptr_aligned = ptr.offset((ptr as usize % 16) as isize * -1);
libc::clone(
mem::transmute(
- callback as extern "C" fn(*mut Box<::std::ops::FnMut() -> isize>) -> i32,
+ callback as extern "C" fn(*mut Box<dyn FnMut() -> isize>) -> i32,
),
ptr_aligned as *mut c_void,
combined,
diff --git a/src/sys/aio.rs b/src/sys/aio.rs
index 40fa4e15..9258a065 100644
--- a/src/sys/aio.rs
+++ b/src/sys/aio.rs
@@ -102,9 +102,9 @@ pub enum Buffer<'a> {
/// Keeps a reference to a slice
Phantom(PhantomData<&'a mut [u8]>),
/// Generic thing that keeps a buffer from dropping
- BoxedSlice(Box<Borrow<[u8]>>),
+ BoxedSlice(Box<dyn Borrow<[u8]>>),
/// Generic thing that keeps a mutable buffer from dropping
- BoxedMutSlice(Box<BorrowMut<[u8]>>),
+ BoxedMutSlice(Box<dyn BorrowMut<[u8]>>),
}
impl<'a> Debug for Buffer<'a> {
@@ -116,14 +116,14 @@ impl<'a> Debug for Buffer<'a> {
Buffer::None => write!(fmt, "None"),
Buffer::Phantom(p) => p.fmt(fmt),
Buffer::BoxedSlice(ref bs) => {
- let borrowed : &Borrow<[u8]> = bs.borrow();
+ let borrowed : &dyn Borrow<[u8]> = bs.borrow();
write!(fmt, "BoxedSlice({:?})",
- borrowed as *const Borrow<[u8]>)
+ borrowed as *const dyn Borrow<[u8]>)
},
Buffer::BoxedMutSlice(ref bms) => {
- let borrowed : &BorrowMut<[u8]> = bms.borrow();
+ let borrowed : &dyn BorrowMut<[u8]> = bms.borrow();
write!(fmt, "BoxedMutSlice({:?})",
- borrowed as *const BorrowMut<[u8]>)
+ borrowed as *const dyn BorrowMut<[u8]>)
}
}
}
@@ -165,7 +165,7 @@ impl<'a> AioCb<'a> {
///
/// It is an error to call this method while the `AioCb` is still in
/// progress.
- pub fn boxed_slice(&mut self) -> Option<Box<Borrow<[u8]>>> {
+ pub fn boxed_slice(&mut self) -> Option<Box<dyn Borrow<[u8]>>> {
assert!(!self.in_progress, "Can't remove the buffer from an AioCb that's still in-progress. Did you forget to call aio_return?");
if let Buffer::BoxedSlice(_) = self.buffer {
let mut oldbuffer = Buffer::None;
@@ -187,7 +187,7 @@ impl<'a> AioCb<'a> {
///
/// It is an error to call this method while the `AioCb` is still in
/// progress.
- pub fn boxed_mut_slice(&mut self) -> Option<Box<BorrowMut<[u8]>>> {
+ pub fn boxed_mut_slice(&mut self) -> Option<Box<dyn BorrowMut<[u8]>>> {
assert!(!self.in_progress, "Can't remove the buffer from an AioCb that's still in-progress. Did you forget to call aio_return?");
if let Buffer::BoxedMutSlice(_) = self.buffer {
let mut oldbuffer = Buffer::None;
@@ -448,12 +448,12 @@ impl<'a> AioCb<'a> {
/// ```
///
/// [`from_slice`]: #method.from_slice
- pub fn from_boxed_slice(fd: RawFd, offs: off_t, buf: Box<Borrow<[u8]>>,
+ pub fn from_boxed_slice(fd: RawFd, offs: off_t, buf: Box<dyn Borrow<[u8]>>,
prio: libc::c_int, sigev_notify: SigevNotify,
opcode: LioOpcode) -> AioCb<'a> {
let mut a = AioCb::common_init(fd, prio, sigev_notify);
{
- let borrowed : &Borrow<[u8]> = buf.borrow();
+ let borrowed : &dyn Borrow<[u8]> = buf.borrow();
let slice : &[u8] = borrowed.borrow();
a.aio_nbytes = slice.len() as size_t;
a.aio_buf = slice.as_ptr() as *mut c_void;
@@ -516,12 +516,12 @@ impl<'a> AioCb<'a> {
/// [`from_boxed_slice`]: #method.from_boxed_slice
/// [`from_mut_slice`]: #method.from_mut_slice
pub fn from_boxed_mut_slice(fd: RawFd, offs: off_t,
- mut buf: Box<BorrowMut<[u8]>>,
+ mut buf: Box<dyn BorrowMut<[u8]>>,
prio: libc::c_int, sigev_notify: SigevNotify,
opcode: LioOpcode) -> AioCb<'a> {
let mut a = AioCb::common_init(fd, prio, sigev_notify);
{
- let borrowed : &mut BorrowMut<[u8]> = buf.borrow_mut();
+ let borrowed : &mut dyn BorrowMut<[u8]> = buf.borrow_mut();
let slice : &mut [u8] = borrowed.borrow_mut();
a.aio_nbytes = slice.len() as size_t;
a.aio_buf = slice.as_mut_ptr() as *mut c_void;
diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs
index d3cbdaac..1c12c5f8 100644
--- a/src/sys/socket/mod.rs
+++ b/src/sys/socket/mod.rs
@@ -895,7 +895,7 @@ pub fn sendmsg(fd: RawFd, iov: &[IoVec<&[u8]>], cmsgs: &[ControlMessage],
/// # References
/// [recvmsg(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html)
pub fn recvmsg<'a>(fd: RawFd, iov: &[IoVec<&mut [u8]>],
- cmsg_buffer: Option<&'a mut CmsgBuffer>,
+ cmsg_buffer: Option<&'a mut dyn CmsgBuffer>,
flags: MsgFlags) -> Result<RecvMsg<'a>>
{
let mut address: sockaddr_storage = unsafe { mem::uninitialized() };