auto merge of #6780 : june0cho/rust/issue5984, r=brson
Fix #5984. Also, I found a problem on type inference and left a comment.
This commit is contained in:
commit
e0d6486ed6
@ -2346,12 +2346,19 @@ impl<T:Eq> OwnedEqVector<T> for ~[T] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait MutableVector<T> {
|
pub trait MutableVector<'self, T> {
|
||||||
|
fn mut_slice(&mut self, start: uint, end: uint) -> &'self mut [T];
|
||||||
|
|
||||||
unsafe fn unsafe_mut_ref(&self, index: uint) -> *mut T;
|
unsafe fn unsafe_mut_ref(&self, index: uint) -> *mut T;
|
||||||
unsafe fn unsafe_set(&self, index: uint, val: T);
|
unsafe fn unsafe_set(&self, index: uint, val: T);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'self,T> MutableVector<T> for &'self mut [T] {
|
impl<'self,T> MutableVector<'self, T> for &'self mut [T] {
|
||||||
|
#[inline]
|
||||||
|
fn mut_slice(&mut self, start: uint, end: uint) -> &'self mut [T] {
|
||||||
|
mut_slice(*self, start, end)
|
||||||
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
unsafe fn unsafe_mut_ref(&self, index: uint) -> *mut T {
|
unsafe fn unsafe_mut_ref(&self, index: uint) -> *mut T {
|
||||||
let pair_ptr: &(*mut T, uint) = transmute(self);
|
let pair_ptr: &(*mut T, uint) = transmute(self);
|
||||||
|
Loading…
Reference in New Issue
Block a user