From a4b7ed7a42c716ab9f05e351f003d589124fd55d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:58 +0200 Subject: Adding upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/debuginfo/captured-fields-2.rs | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tests/debuginfo/captured-fields-2.rs (limited to 'tests/debuginfo/captured-fields-2.rs') diff --git a/tests/debuginfo/captured-fields-2.rs b/tests/debuginfo/captured-fields-2.rs new file mode 100644 index 000000000..c872354a9 --- /dev/null +++ b/tests/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() {} -- cgit v1.2.3