about summary refs log tree commit diff
path: root/tests/ui/async-await/issues/non-async-enclosing-span.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await/issues/non-async-enclosing-span.rs')
-rw-r--r--tests/ui/async-await/issues/non-async-enclosing-span.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/async-await/issues/non-async-enclosing-span.rs b/tests/ui/async-await/issues/non-async-enclosing-span.rs
new file mode 100644
index 00000000000..d47c2137725
--- /dev/null
+++ b/tests/ui/async-await/issues/non-async-enclosing-span.rs
@@ -0,0 +1,11 @@
+// edition:2018
+
+async fn do_the_thing() -> u8 {
+    8
+}
+// #63398: point at the enclosing scope and not the previously seen closure
+fn main() {  //~ NOTE this is not `async`
+    let x = move || {};
+    let y = do_the_thing().await; //~ ERROR `await` is only allowed inside `async` functions
+    //~^ NOTE only allowed inside `async` functions and blocks
+}