Files
rust/src/test/ui/async-await/issues/issue-62097.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
500 B
Rust
Raw Normal View History

2022-05-21 15:46:25 -04:00
// ignore-compare-mode-nll
// revisions: base nll
// [nll]compile-flags: -Zborrowck=mir
2019-10-24 01:25:05 +08:00
// edition:2018
async fn foo<F>(fun: F)
where
F: FnOnce() + 'static
{
fun()
}
struct Struct;
impl Struct {
2022-05-21 15:46:25 -04:00
pub async fn run_dummy_fn(&self) {
//[base]~^ ERROR E0759
2019-10-24 01:25:05 +08:00
foo(|| self.bar()).await;
2022-05-21 15:46:25 -04:00
//[nll]~^ ERROR closure may outlive the current function
//[nll]~| ERROR borrowed data escapes outside of associated function
2019-10-24 01:25:05 +08:00
}
pub fn bar(&self) {}
}
fn main() {}