]>
Commit | Line | Data |
---|---|---|
60c5eb7d XL |
1 | // edition:2018 |
2 | async fn foo<F>(fun: F) | |
3 | where | |
4 | F: FnOnce() + 'static | |
5 | { | |
6 | fun() | |
7 | } | |
8 | ||
9 | struct Struct; | |
10 | ||
11 | impl Struct { | |
923072b8 | 12 | pub async fn run_dummy_fn(&self) { |
60c5eb7d | 13 | foo(|| self.bar()).await; |
923072b8 FG |
14 | //~^ ERROR closure may outlive the current function |
15 | //~| ERROR borrowed data escapes outside of associated function | |
60c5eb7d XL |
16 | } |
17 | ||
18 | pub fn bar(&self) {} | |
19 | } | |
20 | ||
21 | fn main() {} |