Skip to content

Commit 612ded7

Browse files
debuginfo: Extend option-like-enum test case to contain nested discriminants.
1 parent 796d009 commit 612ded7

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/test/debuginfo/option-like-enum.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
// gdb-command:print void_droid_gdb->internals
3737
// gdb-check:$6 = (isize *) 0x0
3838

39+
// gdb-command:print nested_non_zero_yep
40+
// gdb-check:$7 = {RUST$ENCODED$ENUM$1$2$Nope = {10.5, {a = 10, b = 20, c = [...]}}}
41+
42+
// gdb-command:print nested_non_zero_nope
43+
// gdb-check:$8 = {RUST$ENCODED$ENUM$1$2$Nope = {[...], {a = [...], b = [...], c = 0x0}}}
44+
3945
// gdb-command:continue
4046

4147

@@ -67,6 +73,12 @@
6773
// lldb-command:print none_str
6874
// lldb-check:[...]$7 = None
6975

76+
// lldb-command:print nested_non_zero_yep
77+
// lldb-check:[...]$8 = Yep(10.5, NestedNonZeroField { a: 10, b: 20, c: &[...] })
78+
79+
// lldb-command:print nested_non_zero_nope
80+
// lldb-check:[...]$9 = Nope
81+
7082

7183
#![omit_gdb_pretty_printer_section]
7284

@@ -102,6 +114,17 @@ struct NamedFieldsRepr<'a> {
102114
internals: &'a isize
103115
}
104116

117+
struct NestedNonZeroField<'a> {
118+
a: u16,
119+
b: u32,
120+
c: &'a char,
121+
}
122+
123+
enum NestedNonZero<'a> {
124+
Yep(f64, NestedNonZeroField<'a>),
125+
Nope
126+
}
127+
105128
fn main() {
106129

107130
let some_str: Option<&'static str> = Some("abc");
@@ -124,6 +147,17 @@ fn main() {
124147
let void_droid = NamedFields::Void;
125148
let void_droid_gdb: &NamedFieldsRepr = unsafe { std::mem::transmute(&NamedFields::Void) };
126149

150+
let x = 'x';
151+
let nested_non_zero_yep = NestedNonZero::Yep(
152+
10.5,
153+
NestedNonZeroField {
154+
a: 10,
155+
b: 20,
156+
c: &x
157+
});
158+
159+
let nested_non_zero_nope = NestedNonZero::Nope;
160+
127161
zzz(); // #break
128162
}
129163

0 commit comments

Comments
 (0)