2020-05-01 20:24:14 -05:00
|
|
|
async fn foo() {
|
2020-11-30 15:11:29 -06:00
|
|
|
//~^ ERROR `async fn` is not permitted in Rust 2015
|
2020-12-30 07:33:46 -06:00
|
|
|
//~| NOTE to use `async fn`, switch to Rust 2018 or later
|
2022-03-07 11:50:47 -06:00
|
|
|
//~| HELP pass `--edition 2021` to `rustc`
|
2020-05-01 20:24:14 -05:00
|
|
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
|
|
|
|
|
|
|
let x = async {};
|
|
|
|
//~^ ERROR cannot find struct, variant or union type `async` in this scope
|
2020-11-30 15:11:29 -06:00
|
|
|
//~| NOTE `async` blocks are only allowed in Rust 2018 or later
|
|
|
|
let y = async { //~ NOTE `async` blocks are only allowed in Rust 2018 or later
|
2020-05-01 20:24:14 -05:00
|
|
|
let x = 42;
|
|
|
|
//~^ ERROR expected identifier, found keyword `let`
|
|
|
|
//~| NOTE expected identifier, found keyword
|
2022-03-07 11:50:47 -06:00
|
|
|
//~| HELP pass `--edition 2021` to `rustc`
|
2020-05-01 20:24:14 -05:00
|
|
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
|
|
|
42
|
|
|
|
};
|
2020-11-30 15:11:29 -06:00
|
|
|
let z = async { //~ NOTE `async` blocks are only allowed in Rust 2018 or later
|
2020-05-01 20:24:14 -05:00
|
|
|
42
|
|
|
|
//~^ ERROR expected identifier, found `42`
|
|
|
|
//~| NOTE expected identifier
|
2022-03-07 11:50:47 -06:00
|
|
|
//~| HELP pass `--edition 2021` to `rustc`
|
2020-05-01 20:24:14 -05:00
|
|
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
|
|
|
};
|
|
|
|
y.await;
|
|
|
|
z.await;
|
|
|
|
x
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|