about summary refs log tree commit diff
path: root/tests/ui/async-await/issues/issue-62097.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await/issues/issue-62097.rs')
-rw-r--r--tests/ui/async-await/issues/issue-62097.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/async-await/issues/issue-62097.rs b/tests/ui/async-await/issues/issue-62097.rs
new file mode 100644
index 00000000000..a24c84cffc7
--- /dev/null
+++ b/tests/ui/async-await/issues/issue-62097.rs
@@ -0,0 +1,21 @@
+// 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 associated function
+    }
+
+    pub fn bar(&self) {}
+}
+
+fn main() {}