Reputation: 23
Why MutableSlice::slice_mut is not implemented for &mut [T]?
Tested on rustc 0.12.0-nightly (b2d4eb186 2014-10-02 15:57:19 +0000):
fn sort<T>(v: &mut [T]){
let (l, r) = v.split_at_mut(2); // Ok
let len = v.slice_mut(1u, 3u).len(); // error: type `&mut [T]` does not implement any method in scope named `slice_mut`
}
#[test]
fn it_works() {
let mut v = [1i, 2, 3, 4, 5, 6];
sort(v);
}
Upvotes: 2
Views: 203
Reputation: 65832
That method had been removed, but the change has since been rolled back. The second line of your sort
function compiles right now.
Upvotes: 2