|
8 | 8 | // gdb-command:run
|
9 | 9 |
|
10 | 10 | // gdb-command:print some
|
11 |
| -// gdb-check:$1 = core::option::Option<&u32>::Some(0x12345678) |
| 11 | +// gdb-check:$1 = core::option::Option<&u32>::Some(0x[...]) |
12 | 12 |
|
13 | 13 | // gdb-command:print none
|
14 | 14 | // gdb-check:$2 = core::option::Option<&u32>::None
|
15 | 15 |
|
16 | 16 | // gdb-command:print full
|
17 |
| -// gdb-check:$3 = option_like_enum::MoreFields::Full(454545, 0x87654321, 9988) |
| 17 | +// gdb-check:$3 = option_like_enum::MoreFields::Full(454545, 0x[...], 9988) |
18 | 18 |
|
19 |
| -// gdb-command:print empty_gdb.discr |
20 |
| -// gdb-check:$4 = (*mut isize) 0x1 |
| 19 | +// gdb-command:print empty |
| 20 | +// gdb-check:$4 = option_like_enum::MoreFields::Empty |
21 | 21 |
|
22 | 22 | // gdb-command:print droid
|
23 |
| -// gdb-check:$5 = option_like_enum::NamedFields::Droid{id: 675675, range: 10000001, internals: 0x43218765} |
| 23 | +// gdb-check:$5 = option_like_enum::NamedFields::Droid{id: 675675, range: 10000001, internals: 0x[...]} |
24 | 24 |
|
25 |
| -// gdb-command:print void_droid_gdb.internals |
26 |
| -// gdb-check:$6 = (*mut isize) 0x1 |
| 25 | +// gdb-command:print void_droid |
| 26 | +// gdb-check:$6 = option_like_enum::NamedFields::Void |
27 | 27 |
|
28 | 28 | // gdb-command:print nested_non_zero_yep
|
29 | 29 | // gdb-check:$7 = option_like_enum::NestedNonZero::Yep(10.5, option_like_enum::NestedNonZeroField {a: 10, b: 20, c: 0x[...]})
|
|
39 | 39 | // lldb-command:run
|
40 | 40 |
|
41 | 41 | // lldb-command:v some
|
42 |
| -// lldb-check:[...] Some(&0x12345678) |
| 42 | +// lldb-check:[...] Some(&0x[...]) |
43 | 43 |
|
44 | 44 | // lldb-command:v none
|
45 | 45 | // lldb-check:[...] None
|
46 | 46 |
|
47 | 47 | // lldb-command:v full
|
48 |
| -// lldb-check:[...] Full(454545, &0x87654321, 9988) |
| 48 | +// lldb-check:[...] Full(454545, &0x[...], 9988) |
49 | 49 |
|
50 | 50 | // lldb-command:v empty
|
51 | 51 | // lldb-check:[...] Empty
|
52 | 52 |
|
53 | 53 | // lldb-command:v droid
|
54 |
| -// lldb-check:[...] Droid { id: 675675, range: 10000001, internals: &0x43218765 } |
| 54 | +// lldb-check:[...] Droid { id: 675675, range: 10000001, internals: &0x[...] } |
55 | 55 |
|
56 | 56 | // lldb-command:v void_droid
|
57 | 57 | // lldb-check:[...] Void
|
|
76 | 76 | // contains a non-nullable pointer, then this value is used as the discriminator.
|
77 | 77 | // The test cases in this file make sure that something readable is generated for
|
78 | 78 | // this kind of types.
|
79 |
| -// If the non-empty variant contains a single non-nullable pointer than the whole |
80 |
| -// item is represented as just a pointer and not wrapped in a struct. |
81 |
| -// Unfortunately (for these test cases) the content of the non-discriminant fields |
82 |
| -// in the null-case is not defined. So we just read the discriminator field in |
83 |
| -// this case (by casting the value to a memory-equivalent struct). |
84 | 79 |
|
85 | 80 | enum MoreFields<'a> {
|
86 | 81 | Full(u32, &'a isize, i16),
|
@@ -120,32 +115,26 @@ fn main() {
|
120 | 115 | let some_str: Option<&'static str> = Some("abc");
|
121 | 116 | let none_str: Option<&'static str> = None;
|
122 | 117 |
|
123 |
| - let some: Option<&u32> = Some(unsafe { std::mem::transmute(0x12345678_usize) }); |
| 118 | + let some: Option<&u32> = Some(&1234); |
124 | 119 | let none: Option<&u32> = None;
|
125 | 120 |
|
126 |
| - let full = MoreFields::Full(454545, unsafe { std::mem::transmute(0x87654321_usize) }, 9988); |
127 |
| - |
| 121 | + let full = MoreFields::Full(454545, &1234, 9988); |
128 | 122 | let empty = MoreFields::Empty;
|
129 |
| - let empty_gdb: &MoreFieldsRepr = unsafe { std::mem::transmute(&MoreFields::Empty) }; |
130 | 123 |
|
131 | 124 | let droid = NamedFields::Droid {
|
132 | 125 | id: 675675,
|
133 | 126 | range: 10000001,
|
134 |
| - internals: unsafe { std::mem::transmute(0x43218765_usize) } |
| 127 | + internals: &1234, |
135 | 128 | };
|
136 |
| - |
137 | 129 | let void_droid = NamedFields::Void;
|
138 |
| - let void_droid_gdb: &NamedFieldsRepr = unsafe { std::mem::transmute(&NamedFields::Void) }; |
139 | 130 |
|
140 |
| - let x = 'x'; |
141 | 131 | let nested_non_zero_yep = NestedNonZero::Yep(
|
142 | 132 | 10.5,
|
143 | 133 | NestedNonZeroField {
|
144 | 134 | a: 10,
|
145 | 135 | b: 20,
|
146 |
| - c: &x |
| 136 | + c: &'x', |
147 | 137 | });
|
148 |
| - |
149 | 138 | let nested_non_zero_nope = NestedNonZero::Nope;
|
150 | 139 |
|
151 | 140 | zzz(); // #break
|
|
0 commit comments