]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/edition-deny-async-fns-2015.rs
Auto merge of #101969 - reez12g:issue-101306, r=reez12g
[rust.git] / src / test / ui / async-await / edition-deny-async-fns-2015.rs
1 // edition:2015
2
3 async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
4
5 fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in Rust 2015
6
7 async fn async_baz() { //~ ERROR `async fn` is not permitted in Rust 2015
8     async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
9 }
10
11 struct Foo {}
12
13 impl Foo {
14     async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
15 }
16
17 trait Bar {
18     async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
19     //~^ ERROR functions in traits cannot be declared `async`
20     //~| ERROR mismatched types
21 }
22
23 fn main() {
24     macro_rules! accept_item { ($x:item) => {} }
25
26     accept_item! {
27         async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
28     }
29
30     accept_item! {
31         impl Foo {
32             async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
33         }
34     }
35
36     let inside_closure = || {
37         async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
38     };
39 }