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
This commit is contained in:
bors 2016-07-03 23:17:50 -07:00 committed by GitHub
commit d98da85c5c
2 changed files with 8 additions and 1 deletions

View File

@ -139,7 +139,7 @@ class Type(object):
return TYPE_KIND_STR_SLICE
# REGULAR SLICE
if (unqualified_type_name.startswith("&[") and
if (unqualified_type_name.startswith(("&[", "&mut [")) and
unqualified_type_name.endswith("]") and
self.__conforms_to_field_layout(SLICE_FIELD_NAMES)):
return TYPE_KIND_SLICE

View File

@ -53,6 +53,11 @@
// gdb-command:print *((int64_t[2]*)('vec_slices::MUT_VECT_SLICE'.data_ptr))
// gdb-check:$15 = {64, 65}
//gdb-command:print mut_slice.length
//gdb-check:$16 = 5
//gdb-command:print *((int64_t[5]*)(mut_slice.data_ptr))
//gdb-check:$17 = {1, 2, 3, 4, 5}
// === LLDB TESTS ==================================================================================
@ -106,6 +111,8 @@ fn main() {
MUT_VECT_SLICE = VECT_SLICE;
}
let mut_slice: &mut [i64] = &mut [1, 2, 3, 4, 5];
zzz(); // #break
}