summaryrefslogtreecommitdiff
path: root/src/sys/aio.rs
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2019-07-02 13:39:25 -0600
committerAlan Somers <asomers@gmail.com>2019-07-13 15:05:08 -0600
commitc156af5a90e89291d4c540610549c3132d884661 (patch)
tree9c4d25b5b9888f1d8993f979a5d0ed5a06270335 /src/sys/aio.rs
parent5e463aa51f0e644d54c21f0db2effa4b757f982a (diff)
downloadnix-c156af5a90e89291d4c540610549c3132d884661.zip
Fix warnings on Rust 1.37.0
* 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) * 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?
Diffstat (limited to 'src/sys/aio.rs')
-rw-r--r--src/sys/aio.rs24
1 files changed, 12 insertions, 12 deletions
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;