diff options
| author | bors <bors@rust-lang.org> | 2018-06-11 20:14:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-06-11 20:14:39 +0000 |
| commit | 1d4dbf488a4364413e7b9611866b7a5c75ce566f (patch) | |
| tree | de372b0f4be645ac0087448bffc272d09a807878 /src/liballoc | |
| parent | 0b7c9e756e8bee2efd4f6929c79f9e3ed9115689 (diff) | |
| parent | fb507cadf32e1eacccc07c1c3511636fd6378f7b (diff) | |
| download | rust-1d4dbf488a4364413e7b9611866b7a5c75ce566f.tar.gz rust-1d4dbf488a4364413e7b9611866b7a5c75ce566f.zip | |
Auto merge of #51442 - tinaun:more-future-impls, r=cramertj
[futures] add a few blanket impls to std these were defined in the futures crate, but with the core definitions moving to std these would need to move too.
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 18 | ||||
| -rw-r--r-- | src/liballoc/lib.rs | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index a64b94b6517..c794fb8220a 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -915,6 +915,24 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<PinBox<U>> for PinBox<T> {} impl<T: ?Sized> Unpin for PinBox<T> {} #[unstable(feature = "futures_api", issue = "50547")] +impl<'a, F: ?Sized + Future + Unpin> Future for Box<F> { + type Output = F::Output; + + fn poll(mut self: PinMut<Self>, cx: &mut Context) -> Poll<Self::Output> { + PinMut::new(&mut **self).poll(cx) + } +} + +#[unstable(feature = "futures_api", issue = "50547")] +impl<'a, F: ?Sized + Future> Future for PinBox<F> { + type Output = F::Output; + + fn poll(mut self: PinMut<Self>, cx: &mut Context) -> Poll<Self::Output> { + self.as_pin_mut().poll(cx) + } +} + +#[unstable(feature = "futures_api", issue = "50547")] unsafe impl<F: Future<Output = ()> + Send + 'static> UnsafePoll for PinBox<F> { fn into_raw(self) -> *mut () { PinBox::into_raw(self) as *mut () diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 242c7d2e70f..a1139189c9a 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -80,6 +80,7 @@ #![cfg_attr(test, feature(rand, test))] #![feature(allocator_api)] #![feature(allow_internal_unstable)] +#![feature(arbitrary_self_types)] #![feature(ascii_ctype)] #![feature(box_into_raw_non_null)] #![feature(box_patterns)] |
