From c156af5a90e89291d4c540610549c3132d884661 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Tue, 2 Jul 2019 13:39:25 -0600 Subject: Fix warnings on Rust 1.37.0 * Replace obsolete range syntax "..." with inclusive range "..=" * Use dyn Trait syntax instead of Box * Raise MSRV to 1.27.0 (for dyn Trait syntax) * Raise MSRV to 1.31.0 (because of rand) tempfile pulls in rand, and rand pulls in fuchsia-cprng, which requires 1.31.0. Why rand pulls in fuchsia-cprng I don't know. It's specified as a target-specific dependency, but Cargo tries to build it anyway (only on Linux, not on FreeBSD or OSX). A bug in Cargo 1.27.0? --- src/sys/aio.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/sys/aio.rs') 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>), + BoxedSlice(Box>), /// Generic thing that keeps a mutable buffer from dropping - BoxedMutSlice(Box>), + BoxedMutSlice(Box>), } 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>> { + pub fn boxed_slice(&mut self) -> Option>> { 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>> { + pub fn boxed_mut_slice(&mut self) -> Option>> { 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>, + pub fn from_boxed_slice(fd: RawFd, offs: off_t, buf: Box>, 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>, + mut buf: Box>, 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; -- cgit v1.2.3