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