@@ -103,9 +103,9 @@ use slice::{Items, MutItems};
103103#[ unsafe_no_drop_flag]
104104#[ stable]
105105pub struct Vec < T > {
106+ ptr : * mut T ,
106107 len : uint ,
107108 cap : uint ,
108- ptr : * mut T
109109}
110110
111111impl < T > Vec < T > {
@@ -125,7 +125,7 @@ impl<T> Vec<T> {
125125 // non-null value which is fine since we never call deallocate on the ptr
126126 // if cap is 0. The reason for this is because the pointer of a slice
127127 // being NULL would break the null pointer optimization for enums.
128- Vec { len : 0 , cap : 0 , ptr : EMPTY as * mut T }
128+ Vec { ptr : EMPTY as * mut T , len : 0 , cap : 0 }
129129 }
130130
131131 /// Constructs a new, empty `Vec` with the specified capacity.
@@ -159,14 +159,14 @@ impl<T> Vec<T> {
159159 #[ stable]
160160 pub fn with_capacity ( capacity : uint ) -> Vec < T > {
161161 if mem:: size_of :: < T > ( ) == 0 {
162- Vec { len : 0 , cap : uint:: MAX , ptr : EMPTY as * mut T }
162+ Vec { ptr : EMPTY as * mut T , len : 0 , cap : uint:: MAX }
163163 } else if capacity == 0 {
164164 Vec :: new ( )
165165 } else {
166166 let size = capacity. checked_mul ( & mem:: size_of :: < T > ( ) )
167167 . expect ( "capacity overflow" ) ;
168168 let ptr = unsafe { allocate ( size, mem:: min_align_of :: < T > ( ) ) } ;
169- Vec { len : 0 , cap : capacity , ptr : ptr as * mut T }
169+ Vec { ptr : ptr as * mut T , len : 0 , cap : capacity }
170170 }
171171 }
172172
@@ -237,9 +237,9 @@ impl<T> Vec<T> {
237237 /// }
238238 /// ```
239239 #[ experimental]
240- pub unsafe fn from_raw_parts ( length : uint , capacity : uint ,
241- ptr : * mut T ) -> Vec < T > {
242- Vec { len : length , cap : capacity , ptr : ptr }
240+ pub unsafe fn from_raw_parts ( ptr : * mut T , length : uint ,
241+ capacity : uint ) -> Vec < T > {
242+ Vec { ptr : ptr , len : length , cap : capacity }
243243 }
244244
245245 /// Consumes the `Vec`, partitioning it based on a predicate.
@@ -1680,7 +1680,7 @@ impl<'a, T> Drop for DerefVec<'a, T> {
16801680pub fn as_vec < ' a , T > ( x : & ' a [ T ] ) -> DerefVec < ' a , T > {
16811681 unsafe {
16821682 DerefVec {
1683- x : Vec :: from_raw_parts ( x. len ( ) , x. len ( ) , x. as_ptr ( ) as * mut T ) ,
1683+ x : Vec :: from_raw_parts ( x. as_ptr ( ) as * mut T , x. len ( ) , x. len ( ) ) ,
16841684 l : ContravariantLifetime :: < ' a >
16851685 }
16861686 }
@@ -1929,7 +1929,7 @@ impl<T> Vec<T> {
19291929 let vec_cap = pv. vec . capacity ( ) ;
19301930 let vec_ptr = pv. vec . as_mut_ptr ( ) as * mut U ;
19311931 mem:: forget ( pv) ;
1932- Vec :: from_raw_parts ( vec_len , vec_cap , vec_ptr )
1932+ Vec :: from_raw_parts ( vec_ptr , vec_len , vec_cap )
19331933 }
19341934 } else {
19351935 // Put the `Vec` into the `PartialVecZeroSized` structure and
0 commit comments