mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Reduce reliance on feature(await_macro).
This commit is contained in:
parent
43315bc15e
commit
3eef0cbfe2
@ -1,6 +1,6 @@
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await, await_macro)]
|
||||
#![feature(async_await)]
|
||||
|
||||
#[path = "../auxiliary/arc_wake.rs"]
|
||||
mod arc_wake;
|
||||
@ -58,31 +58,31 @@ fn wait(fut: impl Future<Output = u8>) -> u8 {
|
||||
fn base() -> WakeOnceThenComplete { WakeOnceThenComplete(false, 1) }
|
||||
|
||||
async fn await1_level1() -> u8 {
|
||||
await!(base())
|
||||
base().await
|
||||
}
|
||||
|
||||
async fn await2_level1() -> u8 {
|
||||
await!(base()) + await!(base())
|
||||
base().await + base().await
|
||||
}
|
||||
|
||||
async fn await3_level1() -> u8 {
|
||||
await!(base()) + await!(base()) + await!(base())
|
||||
base().await + base().await + base().await
|
||||
}
|
||||
|
||||
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 {
|
||||
await!(await3_level2()) + await!(await3_level2()) + await!(await3_level2())
|
||||
await3_level2().await + await3_level2().await + await3_level2().await
|
||||
}
|
||||
|
||||
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 {
|
||||
await!(await3_level4()) + await!(await3_level4()) + await!(await3_level4())
|
||||
await3_level4().await + await3_level4().await + await3_level4().await
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -2,7 +2,7 @@
|
||||
// handled incorrectly in generators.
|
||||
// compile-flags: -Copt-level=z -Cdebuginfo=2 --edition=2018
|
||||
|
||||
#![feature(async_await, await_macro)]
|
||||
#![feature(async_await)]
|
||||
#![allow(unused)]
|
||||
|
||||
use std::future::Future;
|
||||
@ -22,7 +22,7 @@ impl Future for Never {
|
||||
fn main() {
|
||||
let fut = async {
|
||||
let _rc = Rc::new(()); // Also crashes with Arc
|
||||
await!(Never());
|
||||
Never().await;
|
||||
};
|
||||
let _bla = fut; // Moving the future is required.
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await, await_macro)]
|
||||
#![feature(async_await)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
struct HasLifetime<'a>(&'a bool);
|
||||
|
@ -1,7 +1,7 @@
|
||||
// compile-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await, await_macro)]
|
||||
#![feature(async_await)]
|
||||
|
||||
trait MyClosure {
|
||||
type Args;
|
||||
@ -20,7 +20,7 @@ async fn get_future<C: ?Sized + MyClosure>(_stream: MyStream<C>) {}
|
||||
|
||||
async fn f() {
|
||||
let messages: MyStream<dyn FnMut()> = unimplemented!();
|
||||
await!(get_future(messages));
|
||||
get_future(messages).await;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// edition:2018
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
#![feature(async_await, await_macro)]
|
||||
#![feature(async_await)]
|
||||
|
||||
mod outer_mod {
|
||||
pub mod await { //~ ERROR expected identifier, found reserved keyword `await`
|
||||
|
@ -3,7 +3,7 @@
|
||||
// run-pass
|
||||
|
||||
#![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
|
||||
// parameters (used or unused) are not dropped until the async fn completes execution.
|
||||
|
@ -3,7 +3,7 @@
|
||||
// run-pass
|
||||
|
||||
#![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
|
||||
// parameters (used or unused) are not dropped until the async fn completes execution.
|
||||
|
@ -1,7 +1,7 @@
|
||||
// compile-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(arbitrary_self_types, async_await, await_macro)]
|
||||
#![feature(arbitrary_self_types, async_await)]
|
||||
|
||||
use std::task::{self, Poll};
|
||||
use std::future::Future;
|
||||
@ -37,11 +37,11 @@ impl<R, F> Future for Lazy<F>
|
||||
async fn __receive<WantFn, Fut>(want: WantFn) -> ()
|
||||
where Fut: Future<Output = ()>, WantFn: Fn(&Box<dyn Send + 'static>) -> Fut,
|
||||
{
|
||||
await!(lazy(|_| ()));
|
||||
lazy(|_| ()).await;
|
||||
}
|
||||
|
||||
pub fn basic_spawn_receive() {
|
||||
async { await!(__receive(|_| async { () })) };
|
||||
async { __receive(|_| async { () }).await };
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// compile-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await, await_macro)]
|
||||
#![feature(async_await)]
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
// compile-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await, await_macro)]
|
||||
#![feature(async_await)]
|
||||
|
||||
use std::future::Future;
|
||||
|
||||
#[allow(unused)]
|
||||
async fn foo<F: Future<Output = i32>>(x: &i32, future: F) -> i32 {
|
||||
let y = await!(future);
|
||||
let y = future.await;
|
||||
*x + y
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// compile-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await, await_macro)]
|
||||
#![feature(async_await)]
|
||||
|
||||
struct Xyz {
|
||||
a: u64,
|
||||
|
@ -1,7 +1,7 @@
|
||||
// compile-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await, await_macro)]
|
||||
#![feature(async_await)]
|
||||
|
||||
use std::future::Future;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
// compile-flags: --edition=2018
|
||||
|
||||
#![feature(async_await, await_macro)]
|
||||
#![feature(async_await)]
|
||||
|
||||
pub enum Uninhabited { }
|
||||
|
||||
@ -15,7 +15,7 @@ async fn noop() { }
|
||||
#[allow(unused)]
|
||||
async fn contains_never() {
|
||||
let error = uninhabited_async();
|
||||
await!(noop());
|
||||
noop().await;
|
||||
let error2 = error;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// 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)]
|
||||
|
||||
use std::ops::Add;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await, async_closure, await_macro)]
|
||||
#![feature(async_await, async_closure)]
|
||||
|
||||
fn main() {
|
||||
let _ = async |x: u8| {};
|
||||
|
@ -2,10 +2,10 @@
|
||||
// Test that impl trait does not allow creating recursive types that are
|
||||
// otherwise forbidden when using `async` and `await`.
|
||||
|
||||
#![feature(await_macro, async_await, generators)]
|
||||
#![feature(async_await)]
|
||||
|
||||
async fn recursive_async_function() -> () { //~ ERROR
|
||||
await!(recursive_async_function());
|
||||
recursive_async_function().await;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
Loading…
Reference in New Issue
Block a user