about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-06-26 21:09:52 +0000
committerbors <bors@rust-lang.org>2018-06-26 21:09:52 +0000
commit84804c3874a15f55a905c0b53d820372003b0c24 (patch)
treed154389d90ec40f29ea4633d6be6c1add3c9ee6c /src/liballoc
parent9cc3d44b935fb97f19fed4395861cbc8d6bba0e4 (diff)
parentb39ea1d18f19f9cee3ad271a802b3157f9827f51 (diff)
downloadrust-84804c3874a15f55a905c0b53d820372003b0c24.tar.gz
rust-84804c3874a15f55a905c0b53d820372003b0c24.zip
Auto merge of #51814 - MajorBreakfast:local-task-obj, r=cramertj
Add `LocalTaskObj` to `core::task`

- Splits `libcore/task.rs` into submodules
- Adds `LocalTaskObj` and `SpawnLocalObjError` (-> [Commit for this](https://github.com/rust-lang/rust/commit/433e6b31a75eea5ce45493acc63eae462d740338))

Note: To make reviewing easy, both actions have their own commit

r? @cramertj
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/boxed.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index ea60c7775af..6a05ef68088 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, UnsafeTask, TaskObj};
+use core::task::{Context, Poll, UnsafeTask, TaskObj, LocalTaskObj};
 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> UnsafeTask for PinBox<F> {
+unsafe impl<F: Future<Output = ()> + 'static> UnsafeTask for PinBox<F> {
     fn into_raw(self) -> *mut () {
         PinBox::into_raw(self) as *mut ()
     }
@@ -962,3 +962,17 @@ impl<F: Future<Output = ()> + Send + 'static> From<Box<F>> for TaskObj {
         TaskObj::new(PinBox::from(boxed))
     }
 }
+
+#[unstable(feature = "futures_api", issue = "50547")]
+impl<F: Future<Output = ()> + 'static> From<PinBox<F>> for LocalTaskObj {
+    fn from(boxed: PinBox<F>) -> Self {
+        LocalTaskObj::new(boxed)
+    }
+}
+
+#[unstable(feature = "futures_api", issue = "50547")]
+impl<F: Future<Output = ()> + 'static> From<Box<F>> for LocalTaskObj {
+    fn from(boxed: Box<F>) -> Self {
+        LocalTaskObj::new(PinBox::from(boxed))
+    }
+}