Skip to content

Commit d98da85

Browse files
authored
Auto merge of #34550 - cynicaldevil:master, r=Manishearth
Added a pretty printer for &mut slices Fixes #30232 I have added a test which checks for correctness in gdb, but I need some help to do the same for lldb. r? @Manishearth
2 parents bbdbe99 + 036b089 commit d98da85

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/etc/debugger_pretty_printers_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def __classify_struct(self):
139139
return TYPE_KIND_STR_SLICE
140140

141141
# REGULAR SLICE
142-
if (unqualified_type_name.startswith("&[") and
142+
if (unqualified_type_name.startswith(("&[", "&mut [")) and
143143
unqualified_type_name.endswith("]") and
144144
self.__conforms_to_field_layout(SLICE_FIELD_NAMES)):
145145
return TYPE_KIND_SLICE

src/test/debuginfo/vec-slices.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@
5353
// gdb-command:print *((int64_t[2]*)('vec_slices::MUT_VECT_SLICE'.data_ptr))
5454
// gdb-check:$15 = {64, 65}
5555

56+
//gdb-command:print mut_slice.length
57+
//gdb-check:$16 = 5
58+
//gdb-command:print *((int64_t[5]*)(mut_slice.data_ptr))
59+
//gdb-check:$17 = {1, 2, 3, 4, 5}
60+
5661

5762
// === LLDB TESTS ==================================================================================
5863

@@ -106,6 +111,8 @@ fn main() {
106111
MUT_VECT_SLICE = VECT_SLICE;
107112
}
108113

114+
let mut_slice: &mut [i64] = &mut [1, 2, 3, 4, 5];
115+
109116
zzz(); // #break
110117
}
111118

0 commit comments

Comments
 (0)