2019-10-23 12:25:05 -05:00
|
|
|
// edition:2018
|
|
|
|
async fn foo<F>(fun: F)
|
|
|
|
where
|
|
|
|
F: FnOnce() + 'static
|
|
|
|
{
|
|
|
|
fun()
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Struct;
|
|
|
|
|
|
|
|
impl Struct {
|
2022-05-21 14:46:25 -05:00
|
|
|
pub async fn run_dummy_fn(&self) {
|
2019-10-23 12:25:05 -05:00
|
|
|
foo(|| self.bar()).await;
|
2022-04-01 12:13:25 -05:00
|
|
|
//~^ ERROR closure may outlive the current function
|
2023-02-21 15:11:08 -06:00
|
|
|
//~| ERROR borrowed data escapes outside of method
|
2019-10-23 12:25:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn bar(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|