From 7d85caa33f0b3c5e299b5832cc5e7560ee383283 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Fri, 15 Jan 2021 05:18:49 +0900 Subject: [PATCH] Fix Unpin impl of (Try)MaybeDone --- futures-util/src/future/either.rs | 4 ++-- futures-util/src/future/maybe_done.rs | 4 +++- futures-util/src/future/try_maybe_done.rs | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/futures-util/src/future/either.rs b/futures-util/src/future/either.rs index ee784cd047..a1b9f0a9b3 100644 --- a/futures-util/src/future/either.rs +++ b/futures-util/src/future/either.rs @@ -10,9 +10,9 @@ use futures_sink::Sink; #[derive(Debug, Clone)] pub enum Either { /// First branch of the type - Left(A), + Left(/* #[pin] */ A), /// Second branch of the type - Right(B), + Right(/* #[pin] */ B), } impl Either { diff --git a/futures-util/src/future/maybe_done.rs b/futures-util/src/future/maybe_done.rs index 10b48a22e9..bb5579e859 100644 --- a/futures-util/src/future/maybe_done.rs +++ b/futures-util/src/future/maybe_done.rs @@ -12,7 +12,7 @@ use futures_core::task::{Context, Poll}; #[derive(Debug)] pub enum MaybeDone { /// A not-yet-completed future - Future(Fut), + Future(/* #[pin] */ Fut), /// The output of the completed future Done(Fut::Output), /// The empty variant after the result of a [`MaybeDone`] has been @@ -20,6 +20,8 @@ pub enum MaybeDone { Gone, } +impl Unpin for MaybeDone {} + /// Wraps a future into a `MaybeDone` /// /// # Examples diff --git a/futures-util/src/future/try_maybe_done.rs b/futures-util/src/future/try_maybe_done.rs index 1c95d22fc8..90067e90be 100644 --- a/futures-util/src/future/try_maybe_done.rs +++ b/futures-util/src/future/try_maybe_done.rs @@ -12,7 +12,7 @@ use futures_core::task::{Context, Poll}; #[derive(Debug)] pub enum TryMaybeDone { /// A not-yet-completed future - Future(Fut), + Future(/* #[pin] */ Fut), /// The output of the completed future Done(Fut::Ok), /// The empty variant after the result of a [`TryMaybeDone`] has been @@ -21,6 +21,8 @@ pub enum TryMaybeDone { Gone, } +impl Unpin for TryMaybeDone {} + /// Wraps a future into a `TryMaybeDone` pub fn try_maybe_done(future: Fut) -> TryMaybeDone { TryMaybeDone::Future(future)