@@ -1900,6 +1900,22 @@ unsafe impl<T: ?Sized> IsZero for Option<Box<T>> {
19001900// Common trait implementations for Vec
19011901////////////////////////////////////////////////////////////////////////////////
19021902
1903+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
1904+ impl < T > ops:: Deref for Vec < T > {
1905+ type Target = [ T ] ;
1906+
1907+ fn deref ( & self ) -> & [ T ] {
1908+ unsafe { slice:: from_raw_parts ( self . as_ptr ( ) , self . len ) }
1909+ }
1910+ }
1911+
1912+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
1913+ impl < T > ops:: DerefMut for Vec < T > {
1914+ fn deref_mut ( & mut self ) -> & mut [ T ] {
1915+ unsafe { slice:: from_raw_parts_mut ( self . as_mut_ptr ( ) , self . len ) }
1916+ }
1917+ }
1918+
19031919#[ stable( feature = "rust1" , since = "1.0.0" ) ]
19041920impl < T : Clone > Clone for Vec < T > {
19051921 #[ cfg( not( test) ) ]
@@ -1955,22 +1971,6 @@ impl<T, I: SliceIndex<[T]>> IndexMut<I> for Vec<T> {
19551971 }
19561972}
19571973
1958- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
1959- impl < T > ops:: Deref for Vec < T > {
1960- type Target = [ T ] ;
1961-
1962- fn deref ( & self ) -> & [ T ] {
1963- unsafe { slice:: from_raw_parts ( self . as_ptr ( ) , self . len ) }
1964- }
1965- }
1966-
1967- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
1968- impl < T > ops:: DerefMut for Vec < T > {
1969- fn deref_mut ( & mut self ) -> & mut [ T ] {
1970- unsafe { slice:: from_raw_parts_mut ( self . as_mut_ptr ( ) , self . len ) }
1971- }
1972- }
1973-
19741974#[ stable( feature = "rust1" , since = "1.0.0" ) ]
19751975impl < T > FromIterator < T > for Vec < T > {
19761976 #[ inline]
0 commit comments