Skip to content

Commit 036b089

Browse files
committed
Added a pretty printer for &mut slices
1 parent 7e07e31 commit 036b089

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/etc/debugger_pretty_printers_common.py

+1-1
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

+7
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)