about summary refs log tree commit diff
path: root/tests/ui/async-await/issue-67765-async-diagnostic.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await/issue-67765-async-diagnostic.rs')
-rw-r--r--tests/ui/async-await/issue-67765-async-diagnostic.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/async-await/issue-67765-async-diagnostic.rs b/tests/ui/async-await/issue-67765-async-diagnostic.rs
new file mode 100644
index 00000000000..5093916e73a
--- /dev/null
+++ b/tests/ui/async-await/issue-67765-async-diagnostic.rs
@@ -0,0 +1,16 @@
+// edition:2018
+//
+// Regression test for issue #67765
+// Tests that we point at the proper location when giving
+// a lifetime error.
+fn main() {}
+
+async fn func<'a>() -> Result<(), &'a str> {
+    let s = String::new();
+
+    let b = &s[..];
+
+    Err(b)?; //~ ERROR cannot return value referencing local variable `s`
+
+    Ok(())
+}