about summary refs log tree commit diff
path: root/tests/ui/async-await/async-closures/lint-closure-returning-async-block.rs
blob: f05d918aef28953214776a363453b899a3cb4ec6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//@ edition: 2021

#![deny(closure_returning_async_block)]

fn main() {
    let x = || async {};
    //~^ ERROR closure returning async block can be made into an async closure

    let x = || async move {};
    //~^ ERROR closure returning async block can be made into an async closure

    let x = move || async move {};
    //~^ ERROR closure returning async block can be made into an async closure

    let x = move || async {};
    //~^ ERROR closure returning async block can be made into an async closure

    let x = || {{ async {} }};
    //~^ ERROR closure returning async block can be made into an async closure
}