Revert "core: add IntoFuture trait and support for await"

This reverts commit f35517ee86.
This commit is contained in:
Wesley Wiser 2019-12-31 19:18:08 -05:00
parent 119307a83e
commit 717702dffd
10 changed files with 12 additions and 90 deletions

View file

@ -112,7 +112,7 @@ async fn mixed_sizes() {
fn main() {
assert_eq!(1028, std::mem::size_of_val(&single()));
assert_eq!(1032, std::mem::size_of_val(&single_with_noop()));
assert_eq!(3080, std::mem::size_of_val(&joined()));
assert_eq!(3080, std::mem::size_of_val(&joined_with_noop()));
assert_eq!(6164, std::mem::size_of_val(&mixed_sizes()));
assert_eq!(3084, std::mem::size_of_val(&joined()));
assert_eq!(3084, std::mem::size_of_val(&joined_with_noop()));
assert_eq!(7188, std::mem::size_of_val(&mixed_sizes()));
}

View file

@ -1,28 +0,0 @@
// check-pass
// edition:2018
#![feature(into_future)]
use std::{future::{Future, IntoFuture}, pin::Pin};
struct AwaitMe;
impl IntoFuture for AwaitMe {
type Output = i32;
type Future = Pin<Box<dyn Future<Output = i32>>>;
fn into_future(self) -> Self::Future {
Box::pin(me())
}
}
async fn me() -> i32 {
41
}
async fn run() {
assert_eq!(AwaitMe.await, 41);
}
fn main() {}

View file

@ -32,8 +32,11 @@ error[E0277]: the trait bound `[closure@$DIR/issue-62009-1.rs:16:5: 16:15]: std:
|
LL | (|_| 2333).await;
| ^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:16:5: 16:15]`
|
::: $SRC_DIR/libstd/future.rs:LL:COL
|
= note: required by `std::future::IntoFuture::into_future`
LL | F: Future,
| ------ required by this bound in `std::future::poll_with_tls_context`
error: aborting due to 4 previous errors