diff options
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 7e5efbe3078..d65aee09232 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -1104,6 +1104,7 @@ impl<T: ?Sized> AsMut<T> for Box<T> { #[stable(feature = "pin", since = "1.33.0")] impl<T: ?Sized> Unpin for Box<T> {} +#[cfg(bootstrap)] #[unstable(feature = "generator_trait", issue = "43122")] impl<G: ?Sized + Generator + Unpin> Generator for Box<G> { type Yield = G::Yield; @@ -1114,6 +1115,7 @@ impl<G: ?Sized + Generator + Unpin> Generator for Box<G> { } } +#[cfg(bootstrap)] #[unstable(feature = "generator_trait", issue = "43122")] impl<G: ?Sized + Generator> Generator for Pin<Box<G>> { type Yield = G::Yield; @@ -1124,6 +1126,28 @@ impl<G: ?Sized + Generator> Generator for Pin<Box<G>> { } } +#[cfg(not(bootstrap))] +#[unstable(feature = "generator_trait", issue = "43122")] +impl<G: ?Sized + Generator<R> + Unpin, R> Generator<R> for Box<G> { + type Yield = G::Yield; + type Return = G::Return; + + fn resume(mut self: Pin<&mut Self>, arg: R) -> GeneratorState<Self::Yield, Self::Return> { + G::resume(Pin::new(&mut *self), arg) + } +} + +#[cfg(not(bootstrap))] +#[unstable(feature = "generator_trait", issue = "43122")] +impl<G: ?Sized + Generator<R>, R> Generator<R> for Pin<Box<G>> { + type Yield = G::Yield; + type Return = G::Return; + + fn resume(mut self: Pin<&mut Self>, arg: R) -> GeneratorState<Self::Yield, Self::Return> { + G::resume((*self).as_mut(), arg) + } +} + #[stable(feature = "futures_api", since = "1.36.0")] impl<F: ?Sized + Future + Unpin> Future for Box<F> { type Output = F::Output; |
