Skip to content

Commit 8ea4a2a

Browse files
---
yaml --- r: 162621 b: refs/heads/try c: 67ba096 h: refs/heads/master i: 162619: 357c72d v: v3
1 parent 4731bfe commit 8ea4a2a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cafe2966770ff377aad6dd9fd808e68055587c58
5-
refs/heads/try: 7608d06027a92ecd5255e760df3847e5418d5d31
5+
refs/heads/try: 67ba096cc30ec0f5fac8deec23d5557012e33d27
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/etc/lldb_rust_formatters.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,14 @@ def print_struct_val_starting_from(field_start_index, val, internal_dict):
6969
assert val.GetType().GetTypeClass() == lldb.eTypeClassStruct
7070

7171
t = val.GetType()
72-
has_field_names = type_has_field_names(t)
7372
type_name = extract_type_name(t.GetName())
73+
num_children = val.num_children
74+
75+
if (num_children - field_start_index) == 0:
76+
# The only field of this struct is the enum discriminant
77+
return type_name
78+
79+
has_field_names = type_has_field_names(t)
7480

7581
if has_field_names:
7682
template = "%(type_name)s {\n%(body)s\n}"
@@ -83,8 +89,6 @@ def print_struct_val_starting_from(field_start_index, val, internal_dict):
8389
# this is a tuple, so don't print the type name
8490
type_name = ""
8591

86-
num_children = val.num_children
87-
8892
def render_child(child_index):
8993
this = ""
9094
if has_field_names:
@@ -105,7 +109,6 @@ def print_enum_val(val, internal_dict):
105109

106110
assert val.GetType().GetTypeClass() == lldb.eTypeClassUnion
107111

108-
109112
if val.num_children == 1:
110113
# This is either an enum with just one variant, or it is an Option-like enum
111114
# where the discriminant is encoded in a non-nullable pointer field. We find

0 commit comments

Comments
 (0)