about summary refs log tree commit diff
path: root/tests/coverage/async_closure.coverage
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-10-16 16:09:41 -0400
committerZalathar <Zalathar@users.noreply.github.com>2024-10-18 20:14:02 +1100
commitcdbf28af7694e0037d2ed8f78c40f60e5aef6de2 (patch)
treefbe1b240f4a6386c71c9abcf8c443761b6c33f6e /tests/coverage/async_closure.coverage
parente7c0d2750726c1f08b1de6956248ec78c4a97af6 (diff)
downloadrust-cdbf28af7694e0037d2ed8f78c40f60e5aef6de2.tar.gz
rust-cdbf28af7694e0037d2ed8f78c40f60e5aef6de2.zip
Dont ICE when computing coverage of synthetic async closure body
Diffstat (limited to 'tests/coverage/async_closure.coverage')
-rw-r--r--tests/coverage/async_closure.coverage24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/coverage/async_closure.coverage b/tests/coverage/async_closure.coverage
new file mode 100644
index 00000000000..fd6edf7c29e
--- /dev/null
+++ b/tests/coverage/async_closure.coverage
@@ -0,0 +1,24 @@
+   LL|       |#![feature(async_closure)]
+   LL|       |//@ edition: 2021
+   LL|       |
+   LL|       |//@ aux-build: executor.rs
+   LL|       |extern crate executor;
+   LL|       |
+   LL|      1|async fn call_once(f: impl async FnOnce()) {
+   LL|      1|    f().await;
+   LL|      1|}
+   LL|       |
+   LL|      1|pub fn main() {
+   LL|      2|    let async_closure = async || {};
+                                               ^1
+  ------------------
+  | async_closure::main::{closure#0}:
+  |   LL|      1|    let async_closure = async || {};
+  ------------------
+  | async_closure::main::{closure#0}::{closure#1}::<i32>:
+  |   LL|      1|    let async_closure = async || {};
+  ------------------
+   LL|      1|    executor::block_on(async_closure());
+   LL|      1|    executor::block_on(call_once(async_closure));
+   LL|      1|}
+