@@ -960,7 +960,7 @@ pub trait ImmutableVector<'a, T> {
960
960
fn flat_map < U > ( & self , f: |t: & T | -> ~[ U ] ) -> ~[ U ] ;
961
961
/// Returns a pointer to the element at the given index, without doing
962
962
/// bounds checking.
963
- unsafe fn unsafe_ref ( & self , index : uint ) -> * T ;
963
+ unsafe fn unsafe_ref ( self , index : uint ) -> & ' a T ;
964
964
965
965
/**
966
966
* Returns an unsafe pointer to the vector's buffer
@@ -1149,8 +1149,8 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] {
1149
1149
}
1150
1150
1151
1151
#[ inline]
1152
- unsafe fn unsafe_ref ( & self , index : uint ) -> * T {
1153
- self . repr ( ) . data . offset ( index as int )
1152
+ unsafe fn unsafe_ref ( self , index : uint ) -> & ' a T {
1153
+ cast :: transmute ( self . repr ( ) . data . offset ( index as int ) )
1154
1154
}
1155
1155
1156
1156
#[ inline]
@@ -2183,7 +2183,7 @@ pub trait MutableVector<'a, T> {
2183
2183
fn move_from ( self , src : ~[ T ] , start : uint , end : uint ) -> uint ;
2184
2184
2185
2185
/// Returns an unsafe mutable pointer to the element in index
2186
- unsafe fn unsafe_mut_ref ( self , index : uint ) -> * mut T ;
2186
+ unsafe fn unsafe_mut_ref ( self , index : uint ) -> & ' a mut T ;
2187
2187
2188
2188
/// Return an unsafe mutable pointer to the vector's buffer.
2189
2189
///
@@ -2361,8 +2361,8 @@ impl<'a,T> MutableVector<'a, T> for &'a mut [T] {
2361
2361
}
2362
2362
2363
2363
#[ inline]
2364
- unsafe fn unsafe_mut_ref ( self , index : uint ) -> * mut T {
2365
- ptr:: mut_offset ( self . repr ( ) . data as * mut T , index as int )
2364
+ unsafe fn unsafe_mut_ref ( self , index : uint ) -> & ' a mut T {
2365
+ cast :: transmute ( ptr:: mut_offset ( self . repr ( ) . data as * mut T , index as int ) )
2366
2366
}
2367
2367
2368
2368
#[ inline]
0 commit comments