about summary refs log tree commit diff
path: root/tests/debuginfo/coroutine-closure.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-01-13 18:13:53 +0000
committerbors <bors@rust-lang.org>2025-01-13 18:13:53 +0000
commit2ae9916816a448fcaab3b2da461de754eda0055a (patch)
treef2286961e0322bd26df849dc13e59cfdc849da06 /tests/debuginfo/coroutine-closure.rs
parent7a202a9056ea19058a2a4b1b4f508f7f4ec3a0f6 (diff)
parent75e9b19d78a601d07df4d8f19f72165026f32103 (diff)
downloadrust-2ae9916816a448fcaab3b2da461de754eda0055a.tar.gz
rust-2ae9916816a448fcaab3b2da461de754eda0055a.zip
Auto merge of #135192 - jdupak-ms:cdb-tests, r=wesleywiser
Add and improve debuginfo tests for Windows

Adds new test for closures and function pointers.
Improves robustness of existing tests by sorting wildcard matched outputs.

try-job: i686-msvc
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() {
+    ()
+}