]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/edition-deny-async-fns-2015.rs
Rollup merge of #107065 - flip1995:clippyup, r=Manishearth
[rust.git] / tests / 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 }
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 Rust 2015
27     }
28
29     accept_item! {
30         impl Foo {
31             async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
32         }
33     }
34
35     let inside_closure = || {
36         async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
37     };
38 }