diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index cf605f507bca6..b5d3129d2683e 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -303,8 +303,10 @@ impl SliceExt for [T] { fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]) { let len = self.len(); let ptr = self.as_mut_ptr(); - assert!(mid <= len); + unsafe { + assert!(mid <= len); + (from_raw_parts_mut(ptr, mid), from_raw_parts_mut(ptr.offset(mid as isize), len - mid)) }