summaryrefslogtreecommitdiffstats
path: root/tests/debuginfo/lexical-scope-in-if-let.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/debuginfo/lexical-scope-in-if-let.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/debuginfo/lexical-scope-in-if-let.rs')
-rw-r--r--tests/debuginfo/lexical-scope-in-if-let.rs100
1 files changed, 100 insertions, 0 deletions
diff --git a/tests/debuginfo/lexical-scope-in-if-let.rs b/tests/debuginfo/lexical-scope-in-if-let.rs
new file mode 100644
index 000000000..8fee459bd
--- /dev/null
+++ b/tests/debuginfo/lexical-scope-in-if-let.rs
@@ -0,0 +1,100 @@
+// compile-flags:-g
+
+// === GDB TESTS ==================================================================================
+
+// gdb-command:run
+// gdb-command:info locals
+// gdb-check:a = 123
+
+// gdb-command:continue
+// gdb-command:info locals
+// gdb-check:x = 42
+// gdb-check:a = 123
+
+// gdb-command:continue
+// gdb-command:info locals
+// gdb-check:y = true
+// gdb-check:b = 456
+// gdb-check:x = 42
+// gdb-check:a = 123
+
+// gdb-command:continue
+// gdb-command:info locals
+// gdb-check:z = 10
+// gdb-check:c = 789
+// gdb-check:y = true
+// gdb-check:b = 456
+// gdb-check:x = 42
+// gdb-check:a = 123
+
+// === LLDB TESTS =================================================================================
+
+// lldb-command:run
+// lldb-command:frame variable
+// lldb-check:(int) a = 123
+
+// lldb-command:continue
+// lldb-command:frame variable
+// lldb-check:(int) a = 123 (int) x = 42
+
+// lldb-command:continue
+// lldb-command:frame variable
+// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true
+
+// lldb-command:continue
+// lldb-command:frame variable
+// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true (int) c = 789 (int) z = 10
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+// cdb-command: dv
+// cdb-check:[...]a = 0n123
+
+// cdb-command: g
+// cdb-command: dv
+// cdb-check:[...]a = 0n123
+// cdb-check:[...]x = 0n42
+
+// cdb-command: g
+// cdb-command: dv
+// cdb-check:[...]a = 0n123
+// cdb-check:[...]x = 0n42
+// cdb-check:[...]b = 0n456
+// cdb-check:[...]y = true
+
+// cdb-command: g
+// cdb-command: dv
+// cdb-check:[...]z = 0n10
+// cdb-check:[...]c = 0n789
+// cdb-check:[...]a = 0n123
+// cdb-check:[...]x = 0n42
+// cdb-check:[...]b = 0n456
+// cdb-check:[...]y = true
+
+fn main() {
+ let a = id(123);
+
+ zzz(); // #break
+
+ if let Some(x) = id(Some(42)) {
+ zzz(); // #break
+
+ let b = id(456);
+
+ if let Ok(y) = id::<Result<bool, ()>>(Ok(true)) {
+ zzz(); // #break
+
+ let c = id(789);
+
+ if let (z, 42) = id((10, 42)) {
+ zzz(); // #break
+ }
+ }
+ }
+}
+
+#[inline(never)]
+fn id<T>(value: T) -> T { value }
+
+fn zzz() { }