about summary refs log tree commit diff
path: root/tests/debuginfo/coroutine-closure.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/debuginfo/coroutine-closure.rs')
-rw-r--r--tests/debuginfo/coroutine-closure.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/debuginfo/coroutine-closure.rs b/tests/debuginfo/coroutine-closure.rs
new file mode 100644
index 00000000000..ffb6ae68a2b
--- /dev/null
+++ b/tests/debuginfo/coroutine-closure.rs
@@ -0,0 +1,29 @@
+#![feature(async_closure)]
+//@ only-cdb
+//@ compile-flags:-g --edition=2021
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+// cdb-command: dx closure
+// cdb-check:closure          [Type: coroutine_closure::main::closure_env$0]
+// cdb-check:     [+0x[...]] y                : "" [Type: alloc::string::String]
+// cdb-check:     [+0x[...]] x                : "" [Type: alloc::string::String]
+#![allow(unused)]
+fn main() {
+    let x = String::new();
+    let y = String::new();
+    let closure = async move || {
+        drop(y);
+        println!("{x}");
+    };
+
+    _zzz(); // #break
+
+    std::hint::black_box(closure);
+}
+
+#[inline(never)]
+fn _zzz() {
+    ()
+}