]> git.lizzy.rs Git - rust.git/blob - src/test/ui/editions/async-block-2015.rs
Rollup merge of #103065 - aDotInTheVoid:rdj-arg-pattern, r=GuillaumeGomez
[rust.git] / src / test / ui / editions / async-block-2015.rs
1 async fn foo() {
2 //~^ ERROR `async fn` is not permitted in Rust 2015
3 //~| NOTE to use `async fn`, switch to Rust 2018 or later
4 //~| HELP pass `--edition 2021` to `rustc`
5 //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
6
7     let x = async {};
8     //~^ ERROR cannot find struct, variant or union type `async` in this scope
9     //~| NOTE `async` blocks are only allowed in Rust 2018 or later
10     let y = async { //~ NOTE `async` blocks are only allowed in Rust 2018 or later
11         let x = 42;
12         //~^ ERROR expected identifier, found keyword `let`
13         //~| NOTE expected identifier, found keyword
14         //~| HELP pass `--edition 2021` to `rustc`
15         //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
16         42
17     };
18     let z = async { //~ NOTE `async` blocks are only allowed in Rust 2018 or later
19         42
20         //~^ ERROR expected identifier, found `42`
21         //~| NOTE expected identifier
22         //~| HELP pass `--edition 2021` to `rustc`
23         //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
24     };
25     y.await;
26     z.await;
27     x
28 }
29
30 fn main() {}