]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/issue-103624.rs
Erase regions from CallArgument, add test + bless
[rust.git] / src / test / ui / borrowck / issue-103624.rs
1 // edition:2021
2
3 struct StructA {
4     b: StructB,
5 }
6
7 async fn spawn_blocking<T>(f: impl (Fn() -> T) + Send + Sync + 'static) -> T {
8     todo!()
9 }
10
11 impl StructA {
12     async fn foo(&self) {
13         let bar = self.b.bar().await;
14         spawn_blocking(move || {
15             //~^ ERROR borrowed data escapes outside of associated function
16             self.b;
17             //~^ ERROR cannot move out of `self.b`, as `self` is a captured variable in an `Fn` closure
18         })
19         .await;
20     }
21 }
22
23 struct StructB {}
24
25 impl StructB {
26     async fn bar(&self) -> Option<u8> {
27         None
28     }
29 }
30
31 fn main() {}