diff options
| author | bors <bors@rust-lang.org> | 2020-02-07 00:06:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-02-07 00:06:35 +0000 |
| commit | f8fd4624474a68bd26694eff3536b9f3a127b2d3 (patch) | |
| tree | 87251dcf146a39eb1bf7936a6b46453827a17170 /src/liballoc | |
| parent | 442ae7f04026c215a03b155eaaf9cde8bb5cf02a (diff) | |
| parent | 7ef5b8951f9c4e2da8e8a918cd05d1784cbf895b (diff) | |
| download | rust-f8fd4624474a68bd26694eff3536b9f3a127b2d3.tar.gz rust-f8fd4624474a68bd26694eff3536b9f3a127b2d3.zip | |
Auto merge of #68907 - Dylan-DPC:rollup-osm5e8o, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - #67359 (Rename -Zexternal-macro-backtrace to -Zmacro-backtrace and clean up implementation.) - #68524 (Generator Resume Arguments) - #68791 (implement proper linkchecker hardening) - #68886 (Mark fn map_or() as eagerly evaluated.) - #68888 (error code examples: replace some more ignore with compile_fail) - #68894 (Update E0565 examples) Failed merges: r? @ghost
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; |
