mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-14 09:36:06 +00:00
22 lines
357 B
Rust
22 lines
357 B
Rust
// edition:2018
|
|
async fn foo<F>(fun: F)
|
|
where
|
|
F: FnOnce() + 'static
|
|
{
|
|
fun()
|
|
}
|
|
|
|
struct Struct;
|
|
|
|
impl Struct {
|
|
pub async fn run_dummy_fn(&self) {
|
|
foo(|| self.bar()).await;
|
|
//~^ ERROR closure may outlive the current function
|
|
//~| ERROR borrowed data escapes outside of method
|
|
}
|
|
|
|
pub fn bar(&self) {}
|
|
}
|
|
|
|
fn main() {}
|