mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-09 00:00:08 +02:00
io: remove unsafe pin-projections and remove manual Unpin implementations (#1588)
* Removes most pin-projection related unsafe code. * Removes manual Unpin implementations. As references always implement Unpin, there is no need to implement Unpin manually. * Adds tests to check that Unpin requirement does not change accidentally because changing Unpin requirements will be breaking changes.
This commit is contained in:
@@ -21,9 +21,6 @@ where
|
||||
Write { writer, buf }
|
||||
}
|
||||
|
||||
// forward Unpin
|
||||
impl<W: Unpin + ?Sized> Unpin for Write<'_, W> {}
|
||||
|
||||
impl<W> Future for Write<'_, W>
|
||||
where
|
||||
W: AsyncWrite + Unpin + ?Sized,
|
||||
@@ -35,3 +32,14 @@ where
|
||||
Pin::new(&mut *me.writer).poll_write(cx, me.buf)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn assert_unpin() {
|
||||
use std::marker::PhantomPinned;
|
||||
crate::is_unpin::<Write<'_, PhantomPinned>>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user