Reduce reliance on feature(await_macro).

This commit is contained in:
Mazdak Farrokhzad 2019-07-04 00:25:14 +02:00
parent 43315bc15e
commit 3eef0cbfe2
16 changed files with 30 additions and 30 deletions

View File

@ -1,6 +1,6 @@
// edition:2018 // edition:2018
#![feature(async_await, await_macro)] #![feature(async_await)]
#[path = "../auxiliary/arc_wake.rs"] #[path = "../auxiliary/arc_wake.rs"]
mod arc_wake; mod arc_wake;
@ -58,31 +58,31 @@ fn wait(fut: impl Future<Output = u8>) -> u8 {
fn base() -> WakeOnceThenComplete { WakeOnceThenComplete(false, 1) } fn base() -> WakeOnceThenComplete { WakeOnceThenComplete(false, 1) }
async fn await1_level1() -> u8 { async fn await1_level1() -> u8 {
await!(base()) base().await
} }
async fn await2_level1() -> u8 { async fn await2_level1() -> u8 {
await!(base()) + await!(base()) base().await + base().await
} }
async fn await3_level1() -> u8 { async fn await3_level1() -> u8 {
await!(base()) + await!(base()) + await!(base()) base().await + base().await + base().await
} }
async fn await3_level2() -> u8 { async fn await3_level2() -> u8 {
await!(await3_level1()) + await!(await3_level1()) + await!(await3_level1()) await3_level1().await + await3_level1().await + await3_level1().await
} }
async fn await3_level3() -> u8 { async fn await3_level3() -> u8 {
await!(await3_level2()) + await!(await3_level2()) + await!(await3_level2()) await3_level2().await + await3_level2().await + await3_level2().await
} }
async fn await3_level4() -> u8 { async fn await3_level4() -> u8 {
await!(await3_level3()) + await!(await3_level3()) + await!(await3_level3()) await3_level3().await + await3_level3().await + await3_level3().await
} }
async fn await3_level5() -> u8 { async fn await3_level5() -> u8 {
await!(await3_level4()) + await!(await3_level4()) + await!(await3_level4()) await3_level4().await + await3_level4().await + await3_level4().await
} }
fn main() { fn main() {

View File

@ -2,7 +2,7 @@
// handled incorrectly in generators. // handled incorrectly in generators.
// compile-flags: -Copt-level=z -Cdebuginfo=2 --edition=2018 // compile-flags: -Copt-level=z -Cdebuginfo=2 --edition=2018
#![feature(async_await, await_macro)] #![feature(async_await)]
#![allow(unused)] #![allow(unused)]
use std::future::Future; use std::future::Future;
@ -22,7 +22,7 @@ impl Future for Never {
fn main() { fn main() {
let fut = async { let fut = async {
let _rc = Rc::new(()); // Also crashes with Arc let _rc = Rc::new(()); // Also crashes with Arc
await!(Never()); Never().await;
}; };
let _bla = fut; // Moving the future is required. let _bla = fut; // Moving the future is required.
} }

View File

@ -1,6 +1,6 @@
// edition:2018 // edition:2018
#![feature(async_await, await_macro)] #![feature(async_await)]
#![allow(dead_code)] #![allow(dead_code)]
struct HasLifetime<'a>(&'a bool); struct HasLifetime<'a>(&'a bool);

View File

@ -1,7 +1,7 @@
// compile-pass // compile-pass
// edition:2018 // edition:2018
#![feature(async_await, await_macro)] #![feature(async_await)]
trait MyClosure { trait MyClosure {
type Args; type Args;
@ -20,7 +20,7 @@ async fn get_future<C: ?Sized + MyClosure>(_stream: MyStream<C>) {}
async fn f() { async fn f() {
let messages: MyStream<dyn FnMut()> = unimplemented!(); let messages: MyStream<dyn FnMut()> = unimplemented!();
await!(get_future(messages)); get_future(messages).await;
} }
fn main() {} fn main() {}

View File

@ -1,7 +1,7 @@
// edition:2018 // edition:2018
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![feature(async_await, await_macro)] #![feature(async_await)]
mod outer_mod { mod outer_mod {
pub mod await { //~ ERROR expected identifier, found reserved keyword `await` pub mod await { //~ ERROR expected identifier, found reserved keyword `await`

View File

@ -3,7 +3,7 @@
// run-pass // run-pass
#![allow(unused_variables)] #![allow(unused_variables)]
#![feature(async_await, await_macro)] #![feature(async_await)]
// Test that the drop order for parameters in a fn and async fn matches up. Also test that // Test that the drop order for parameters in a fn and async fn matches up. Also test that
// parameters (used or unused) are not dropped until the async fn completes execution. // parameters (used or unused) are not dropped until the async fn completes execution.

View File

@ -3,7 +3,7 @@
// run-pass // run-pass
#![allow(unused_variables)] #![allow(unused_variables)]
#![feature(async_await, await_macro)] #![feature(async_await)]
// Test that the drop order for parameters in a fn and async fn matches up. Also test that // Test that the drop order for parameters in a fn and async fn matches up. Also test that
// parameters (used or unused) are not dropped until the async fn completes execution. // parameters (used or unused) are not dropped until the async fn completes execution.

View File

@ -1,7 +1,7 @@
// compile-pass // compile-pass
// edition:2018 // edition:2018
#![feature(arbitrary_self_types, async_await, await_macro)] #![feature(arbitrary_self_types, async_await)]
use std::task::{self, Poll}; use std::task::{self, Poll};
use std::future::Future; use std::future::Future;
@ -37,11 +37,11 @@ impl<R, F> Future for Lazy<F>
async fn __receive<WantFn, Fut>(want: WantFn) -> () async fn __receive<WantFn, Fut>(want: WantFn) -> ()
where Fut: Future<Output = ()>, WantFn: Fn(&Box<dyn Send + 'static>) -> Fut, where Fut: Future<Output = ()>, WantFn: Fn(&Box<dyn Send + 'static>) -> Fut,
{ {
await!(lazy(|_| ())); lazy(|_| ()).await;
} }
pub fn basic_spawn_receive() { pub fn basic_spawn_receive() {
async { await!(__receive(|_| async { () })) }; async { __receive(|_| async { () }).await };
} }
fn main() {} fn main() {}

View File

@ -1,7 +1,7 @@
// compile-pass // compile-pass
// edition:2018 // edition:2018
#![feature(async_await, await_macro)] #![feature(async_await)]
use std::sync::Arc; use std::sync::Arc;

View File

@ -1,13 +1,13 @@
// compile-pass // compile-pass
// edition:2018 // edition:2018
#![feature(async_await, await_macro)] #![feature(async_await)]
use std::future::Future; use std::future::Future;
#[allow(unused)] #[allow(unused)]
async fn foo<F: Future<Output = i32>>(x: &i32, future: F) -> i32 { async fn foo<F: Future<Output = i32>>(x: &i32, future: F) -> i32 {
let y = await!(future); let y = future.await;
*x + y *x + y
} }

View File

@ -1,7 +1,7 @@
// compile-pass // compile-pass
// edition:2018 // edition:2018
#![feature(async_await, await_macro)] #![feature(async_await)]
struct Xyz { struct Xyz {
a: u64, a: u64,

View File

@ -1,7 +1,7 @@
// compile-pass // compile-pass
// edition:2018 // edition:2018
#![feature(async_await, await_macro)] #![feature(async_await)]
use std::future::Future; use std::future::Future;

View File

@ -2,7 +2,7 @@
// compile-flags: --edition=2018 // compile-flags: --edition=2018
#![feature(async_await, await_macro)] #![feature(async_await)]
pub enum Uninhabited { } pub enum Uninhabited { }
@ -15,7 +15,7 @@ async fn noop() { }
#[allow(unused)] #[allow(unused)]
async fn contains_never() { async fn contains_never() {
let error = uninhabited_async(); let error = uninhabited_async();
await!(noop()); noop().await;
let error2 = error; let error2 = error;
} }

View File

@ -3,7 +3,7 @@
// Test that we can use async fns with multiple arbitrary lifetimes. // Test that we can use async fns with multiple arbitrary lifetimes.
#![feature(arbitrary_self_types, async_await, await_macro)] #![feature(async_await)]
#![allow(dead_code)] #![allow(dead_code)]
use std::ops::Add; use std::ops::Add;

View File

@ -1,6 +1,6 @@
// edition:2018 // edition:2018
#![feature(async_await, async_closure, await_macro)] #![feature(async_await, async_closure)]
fn main() { fn main() {
let _ = async |x: u8| {}; let _ = async |x: u8| {};

View File

@ -2,10 +2,10 @@
// Test that impl trait does not allow creating recursive types that are // Test that impl trait does not allow creating recursive types that are
// otherwise forbidden when using `async` and `await`. // otherwise forbidden when using `async` and `await`.
#![feature(await_macro, async_await, generators)] #![feature(async_await)]
async fn recursive_async_function() -> () { //~ ERROR async fn recursive_async_function() -> () { //~ ERROR
await!(recursive_async_function()); recursive_async_function().await;
} }
fn main() {} fn main() {}