diff options
| author | bors <bors@rust-lang.org> | 2018-06-13 20:44:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-06-13 20:44:17 +0000 |
| commit | b907d966528a6859ec847a2a4d32f092a5be6584 (patch) | |
| tree | 99a6fad3e8564d43b33fa87f44953890dbceb784 /src/liballoc | |
| parent | e12733bfb83949e10d1421fd1bdc3f2568134fc5 (diff) | |
| parent | 2177378e34c5ad431b245e3bd7cd6cd38ab9053a (diff) | |
| download | rust-b907d966528a6859ec847a2a4d32f092a5be6584.tar.gz rust-b907d966528a6859ec847a2a4d32f092a5be6584.zip | |
Auto merge of #51532 - MajorBreakfast:task-future, r=cramertj
Improve core::task::TaskObj - Rename `UnsafePoll` to `UnsafeTask` to avoid confusion with `Poll` - Rename `TaskObj::from_poll_task()` to `TaskObj::new()` - Rename `TaskObj`'s `poll` and `drop` fields to `poll_fn` and `drop_fn` - Implement `Future` for `TaskObj`. Reason: It's a custom trait object for a future, so it should implement future - Remove `unsafe impl Sync` for `TaskObj`. I don't think we need it. Was this safe? `UnsafeTask` only requires to implement `Send` @cramertj @aturon
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index c794fb8220a..ea60c7775af 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -66,7 +66,7 @@ use core::marker::{Unpin, Unsize}; use core::mem::{self, PinMut}; use core::ops::{CoerceUnsized, Deref, DerefMut, Generator, GeneratorState}; use core::ptr::{self, NonNull, Unique}; -use core::task::{Context, Poll, UnsafePoll, TaskObj}; +use core::task::{Context, Poll, UnsafeTask, TaskObj}; use core::convert::From; use raw_vec::RawVec; @@ -933,7 +933,7 @@ impl<'a, F: ?Sized + Future> Future for PinBox<F> { } #[unstable(feature = "futures_api", issue = "50547")] -unsafe impl<F: Future<Output = ()> + Send + 'static> UnsafePoll for PinBox<F> { +unsafe impl<F: Future<Output = ()> + Send + 'static> UnsafeTask for PinBox<F> { fn into_raw(self) -> *mut () { PinBox::into_raw(self) as *mut () } @@ -952,13 +952,13 @@ unsafe impl<F: Future<Output = ()> + Send + 'static> UnsafePoll for PinBox<F> { #[unstable(feature = "futures_api", issue = "50547")] impl<F: Future<Output = ()> + Send + 'static> From<PinBox<F>> for TaskObj { fn from(boxed: PinBox<F>) -> Self { - TaskObj::from_poll_task(boxed) + TaskObj::new(boxed) } } #[unstable(feature = "futures_api", issue = "50547")] impl<F: Future<Output = ()> + Send + 'static> From<Box<F>> for TaskObj { fn from(boxed: Box<F>) -> Self { - TaskObj::from_poll_task(PinBox::from(boxed)) + TaskObj::new(PinBox::from(boxed)) } } |
