summaryrefslogtreecommitdiffstats
path: root/src/test/debuginfo/captured-fields-2.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/debuginfo/captured-fields-2.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/debuginfo/captured-fields-2.rs')
-rw-r--r--src/test/debuginfo/captured-fields-2.rs55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/test/debuginfo/captured-fields-2.rs b/src/test/debuginfo/captured-fields-2.rs
new file mode 100644
index 000000000..c872354a9
--- /dev/null
+++ b/src/test/debuginfo/captured-fields-2.rs
@@ -0,0 +1,55 @@
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:print my_ref__my_field1
+// gdbr-check:$1 = 11
+// gdb-command:continue
+// gdb-command:print my_var__my_field2
+// gdbr-check:$2 = 22
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print my_ref__my_field1
+// lldbg-check:(unsigned int) $0 = 11
+// lldb-command:continue
+// lldb-command:print my_var__my_field2
+// lldbg-check:(unsigned int) $1 = 22
+// lldb-command:continue
+
+#![feature(capture_disjoint_fields)]
+#![allow(unused)]
+
+struct MyStruct {
+ my_field1: u32,
+ my_field2: u32,
+}
+
+fn main() {
+ let mut my_var = MyStruct {
+ my_field1: 11,
+ my_field2: 22,
+ };
+ let my_ref = &mut my_var;
+
+ let test = || {
+ let a = my_ref.my_field1;
+
+ _zzz(); // #break
+ };
+
+ test();
+
+ let test = move || {
+ let a = my_var.my_field2;
+
+ _zzz(); // #break
+ };
+
+ test();
+}
+
+fn _zzz() {}