diff options
| author | bors <bors@rust-lang.org> | 2018-07-02 20:12:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-07-02 20:12:00 +0000 |
| commit | c8df60a1462b4b83573573c6e08259a731b60a20 (patch) | |
| tree | 9cbebb0f4f49577abb3f97ef8f622e0ef6b433e7 /src/libcore/task/executor.rs | |
| parent | 9363342be956d1bf7781a3b7455d80fc5d94b1f8 (diff) | |
| parent | e666c2bd0742cbf88ff9fa26cfc194099a139589 (diff) | |
| download | rust-c8df60a1462b4b83573573c6e08259a731b60a20.tar.gz rust-c8df60a1462b4b83573573c6e08259a731b60a20.zip | |
Auto merge of #51944 - MajorBreakfast:generic-future-obj, r=cramertj
Make custom trait object for `Future` generic - `TaskObj` -> `FutureObj<'static, ()>` - The `impl From<...> for FutureObj<'a, T>` impls are impossible because of the type parameter `T`. The impl has to live in libstd, but `FutureObj<'a, T>` is from libcore. Therefore `Into<FutureObj<'a, T>>` was implemented instead. Edit: This didn‘t compile without warnings. I am now using non-generic Form impls. See https://github.com/rust-lang-nursery/futures-rs/issues/1058 r? @cramertj Edit: Added lifetime
Diffstat (limited to 'src/libcore/task/executor.rs')
| -rw-r--r-- | src/libcore/task/executor.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libcore/task/executor.rs b/src/libcore/task/executor.rs index 73bf80d2f99..f1db5093e98 100644 --- a/src/libcore/task/executor.rs +++ b/src/libcore/task/executor.rs @@ -13,7 +13,7 @@ issue = "50547")] use fmt; -use super::{TaskObj, LocalTaskObj}; +use future::{FutureObj, LocalFutureObj}; /// A task executor. /// @@ -29,7 +29,7 @@ pub trait Executor { /// /// The executor may be unable to spawn tasks, either because it has /// been shut down or is resource-constrained. - fn spawn_obj(&mut self, task: TaskObj) -> Result<(), SpawnObjError>; + fn spawn_obj(&mut self, task: FutureObj<'static, ()>) -> Result<(), SpawnObjError>; /// Determine whether the executor is able to spawn new tasks. /// @@ -76,7 +76,7 @@ pub struct SpawnObjError { pub kind: SpawnErrorKind, /// The task for which spawning was attempted - pub task: TaskObj, + pub task: FutureObj<'static, ()>, } /// The result of a failed spawn @@ -86,5 +86,5 @@ pub struct SpawnLocalObjError { pub kind: SpawnErrorKind, /// The task for which spawning was attempted - pub task: LocalTaskObj, + pub task: LocalFutureObj<'static, ()>, } |
