Skip to content

Commit 6433e15

Browse files
committed
---
yaml --- r: 171431 b: refs/heads/batch c: 22cae7e h: refs/heads/master i: 171429: ae27465 171427: d787d0c 171423: 41a3e66 v: v3
1 parent 64b7b4f commit 6433e15

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/issue-18208-method-dispatch-2: 9e1eae4fb9b6527315b4441cf8a0f5ca911d1671
3030
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32-
refs/heads/batch: 3d3670bc65a07f1d4dcaca8d0965d3f0ba040101
32+
refs/heads/batch: 22cae7e034254d4c21438f464741d8ede236a23f
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 496dc4eae7de9d14cd49511a9acfbf5f11ae6c3f
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928

branches/batch/src/etc/gdb_rust_pretty_printing.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def rust_pretty_printer_lookup_function(val):
5151
enum_member_count = len(enum_members)
5252

5353
if enum_member_count == 0:
54-
return RustStructPrinter(val, false)
54+
return RustStructPrinter(val, False)
5555

5656
if enum_member_count == 1:
5757
first_variant_name = enum_members[0].name
@@ -60,7 +60,11 @@ def rust_pretty_printer_lookup_function(val):
6060
return rust_pretty_printer_lookup_function(val[enum_members[0]])
6161
else:
6262
assert first_variant_name.startswith("RUST$ENCODED$ENUM$")
63-
# This is a space-optimized enum
63+
# This is a space-optimized enum.
64+
# This means this enum has only two states, and Rust uses one of the
65+
# fields somewhere in the struct to determine which of the two states
66+
# it's in. The location of the field is encoded in the name as something
67+
# like RUST$ENCODED$ENUM$(num$)*name_of_zero_state
6468
last_separator_index = first_variant_name.rfind("$")
6569
start_index = len("RUST$ENCODED$ENUM$")
6670
disr_field_indices = first_variant_name[start_index :
@@ -76,7 +80,7 @@ def rust_pretty_printer_lookup_function(val):
7680
# If the discriminant field is a fat pointer we have to consider the
7781
# first word as the true discriminant
7882
if discriminant.type.code == gdb.TYPE_CODE_STRUCT:
79-
discriminant = discriminant[get_field_at_index(discriminant, 0)]
83+
discriminant = discriminant[get_field_at_index(discriminant, 0)]
8084

8185
if discriminant == 0:
8286
null_variant_name = first_variant_name[last_separator_index + 1:]

branches/batch/src/etc/lldb_rust_formatters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,19 @@ def print_enum_val(val, internal_dict):
131131
try:
132132
disr_field_indices = first_variant_name[start_index :
133133
last_separator_index].split("$")
134-
disr_field_indices = [int(index) for index in dis_field_indices]
134+
disr_field_indices = [int(index) for index in disr_field_indices]
135135
except:
136136
return "<invalid enum encoding: %s>" % first_variant_name
137137

138138
# Read the discriminant
139139
disr_val = val.GetChildAtIndex(0)
140140
for index in disr_field_indices:
141-
disr_val = disr_val.GetChildAtIndex(disr_field_index)
141+
disr_val = disr_val.GetChildAtIndex(index)
142142

143143
# If the discriminant field is a fat pointer we have to consider the
144144
# first word as the true discriminant
145145
if disr_val.GetType().GetTypeClass() == lldb.eTypeClassStruct:
146-
disr_val = disr_val.GetChildAtIndex(0)
146+
disr_val = disr_val.GetChildAtIndex(0)
147147

148148
if disr_val.GetValueAsUnsigned() == 0:
149149
# Null case: Print the name of the null-variant

0 commit comments

Comments
 (0)