Skip to content

Commit 2c54502

Browse files
taiki-ecramertj
authored andcommitted
Fix some Unpin implementations
1 parent 3780e76 commit 2c54502

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

futures-util/src/future/chain.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ pub(crate) enum Chain<Fut1, Fut2, Data> {
1010
Empty,
1111
}
1212

13+
impl<Fut1: Unpin, Fut2: Unpin, Data> Unpin for Chain<Fut1, Fut2, Data> {}
14+
1315
impl<Fut1, Fut2, Data> Chain<Fut1, Fut2, Data> {
1416
pub(crate)fn is_terminated(&self) -> bool {
1517
if let Chain::Empty = *self { true } else { false }

futures-util/src/sink/close.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ pub struct Close<'a, Si: Sink<Item> + Unpin + ?Sized, Item> {
1212
_phantom: PhantomData<fn(Item)>,
1313
}
1414

15+
impl<Si: Sink<Item> + Unpin + ?Sized, Item> Unpin for Close<'_, Si, Item> {}
16+
1517
/// A future that completes when the sink has finished closing.
1618
///
1719
/// The sink itself is returned after closeing is complete.

futures-util/src/sink/drain.rs

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ pub fn drain<T>() -> Drain<T> {
3030
Drain { marker: PhantomData }
3131
}
3232

33+
impl<T> Unpin for Drain<T> {}
34+
3335
impl<T> Sink<T> for Drain<T> {
3436
type Error = Never;
3537

futures-util/src/stream/pending.rs

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ pub fn pending<T>() -> Pending<T> {
1717
Pending { _data: marker::PhantomData }
1818
}
1919

20+
impl<T> Unpin for Pending<T> {}
21+
2022
impl<T> FusedStream for Pending<T> {
2123
fn is_terminated(&self) -> bool {
2224
true

futures-util/src/try_future/try_chain.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ pub(crate) enum TryChain<Fut1, Fut2, Data> {
1010
Empty,
1111
}
1212

13+
impl<Fut1: Unpin, Fut2: Unpin, Data> Unpin for TryChain<Fut1, Fut2, Data> {}
14+
1315
pub(crate) enum TryChainAction<Fut2>
1416
where Fut2: TryFuture,
1517
{

0 commit comments

Comments
 (0)