about summary refs log tree commit diff
path: root/src/test/ui/async-await/issues/non-async-enclosing-span.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/async-await/issues/non-async-enclosing-span.rs')
-rw-r--r--src/test/ui/async-await/issues/non-async-enclosing-span.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/async-await/issues/non-async-enclosing-span.rs b/src/test/ui/async-await/issues/non-async-enclosing-span.rs
new file mode 100644
index 00000000000..838911d9b6e
--- /dev/null
+++ b/src/test/ui/async-await/issues/non-async-enclosing-span.rs
@@ -0,0 +1,12 @@
+// edition:2018
+#![feature(async_await)]
+
+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
+}