about summary refs log tree commit diff
path: root/tests/ui/async-await/async-closures/closure-shim-borrowck-error.rs
blob: 12dca587e07d57adda3eeb2fec25ffebb7b7c269 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//@ compile-flags: -Zvalidate-mir --crate-type=lib -Copt-level=3
//@ edition: 2018

fn main() {}

fn needs_fn_mut<T>(mut x: impl FnMut() -> T) {
    x();
}

fn hello(x: Ty) {
    needs_fn_mut(async || {
        //~^ ERROR cannot move out of `x`
        x.hello();
    });
}

struct Ty;
impl Ty {
    fn hello(self) {}
}