Skip to content

Commit adbe9f9

Browse files
committed
remove taskobjext
1 parent 88af39e commit adbe9f9

File tree

2 files changed

+2
-60
lines changed

2 files changed

+2
-60
lines changed

futures-core/src/future/mod.rs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -26,51 +26,6 @@ pub trait CoreFutureExt: Future {
2626

2727
impl<T: ?Sized> CoreFutureExt for T where T: Future {}
2828

29-
// should be in std
30-
// impl<'a, F: ?Sized + Future + Unpin> Future for &'a mut F {
31-
// type Output = F::Output;
32-
33-
// fn poll(mut self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> {
34-
// F::poll(PinMut::new(&mut **self), cx)
35-
// }
36-
// }
37-
38-
// impl<'a, F: ?Sized + Future> Future for PinMut<'a, F> {
39-
// type Output = F::Output;
40-
41-
// fn poll(mut self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> {
42-
// F::poll((*self).reborrow(), cx)
43-
// }
44-
// }
45-
46-
// if_std! {
47-
// use std::boxed::{Box, PinBox};
48-
49-
// impl<'a, F: ?Sized + Future + Unpin> Future for Box<F> {
50-
// type Output = F::Output;
51-
52-
// fn poll(mut self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> {
53-
// (**self).poll_unpin(cx)
54-
// }
55-
// }
56-
57-
// impl<'a, F: ?Sized + Future> Future for PinBox<F> {
58-
// type Output = F::Output;
59-
60-
// fn poll(mut self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> {
61-
// self.as_pin_mut().poll(cx)
62-
// }
63-
// }
64-
65-
// impl<'a, F: Future> Future for ::std::panic::AssertUnwindSafe<F> {
66-
// type Output = F::Output;
67-
68-
// fn poll(mut self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> {
69-
// unsafe { pinned_field!(self, 0).poll(cx) }
70-
// }
71-
// }
72-
// }
73-
7429
/// A convenience for futures that return `Result` values that includes
7530
/// a variety of adapters tailored to such futures.
7631
pub trait TryFuture {

futures-core/src/task/mod.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,11 @@ mod atomic_waker;
1313
#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
1414
pub use self::atomic_waker::AtomicWaker;
1515

16-
pub use core::task::{TaskObj, UnsafePoll};
16+
pub use core::task::{TaskObj, UnsafeTask};
1717

1818
if_std! {
1919
use std::boxed::PinBox;
2020

21-
/// Extension trait for `TaskObj`, adding methods that require allocation.
22-
pub trait TaskObjExt {
23-
/// Create a new `TaskObj` by boxing the given future.
24-
fn new<F: Future<Output = ()> + Send + 'static>(f: F) -> TaskObj;
25-
}
26-
27-
impl TaskObjExt for TaskObj {
28-
/// Create a new `TaskObj` by boxing the given future.
29-
fn new<F: Future<Output = ()> + Send + 'static>(f: F) -> TaskObj {
30-
TaskObj::from_poll_task(PinBox::new(f))
31-
}
32-
}
33-
3421
/// Extension trait for `Context`, adding methods that require allocation.
3522
pub trait ContextExt {
3623
/// Spawn a future onto the default executor.
@@ -47,7 +34,7 @@ if_std! {
4734
impl<'a> ContextExt for Context<'a> {
4835
fn spawn<F>(&mut self, f: F) where F: Future<Output = ()> + 'static + Send {
4936
self.executor()
50-
.spawn_obj(TaskObj::new(f)).unwrap()
37+
.spawn_obj(TaskObj::new(PinBox::new(f))).unwrap()
5138
}
5239
}
5340
}

0 commit comments

Comments
 (0)