@@ -1201,6 +1201,8 @@ pub trait OwnedVector<T> {
1201
1201
fn shrink_to_fit ( & mut self ) ;
1202
1202
1203
1203
fn push ( & mut self , t : T ) ;
1204
+ unsafe fn push_fast ( & mut self , t : T ) ;
1205
+
1204
1206
fn push_all_move ( & mut self , rhs : ~[ T ] ) ;
1205
1207
fn pop ( & mut self ) -> T ;
1206
1208
fn pop_opt ( & mut self ) -> Option < T > ;
@@ -1332,7 +1334,7 @@ impl<T> OwnedVector<T> for ~[T] {
1332
1334
self . reserve_at_least ( new_len) ;
1333
1335
}
1334
1336
1335
- push_fast ( self , t) ;
1337
+ self . push_fast ( t) ;
1336
1338
} else {
1337
1339
let repr: * * Vec < ( ) > = cast:: transmute ( & mut * self ) ;
1338
1340
let fill = ( * * repr) . fill ;
@@ -1341,30 +1343,29 @@ impl<T> OwnedVector<T> for ~[T] {
1341
1343
self . reserve_at_least ( new_len) ;
1342
1344
}
1343
1345
1344
- push_fast ( self , t) ;
1346
+ self . push_fast ( t) ;
1345
1347
}
1346
1348
}
1349
+ }
1347
1350
1348
- // This doesn't bother to make sure we have space.
1349
- #[ inline] // really pretty please
1350
- unsafe fn push_fast < T > ( this : & mut ~[ T ] , t : T ) {
1351
- if contains_managed :: < T > ( ) {
1352
- let repr: * * mut Box < Vec < u8 > > = cast:: transmute ( this) ;
1353
- let fill = ( * * repr) . data . fill ;
1354
- ( * * repr) . data . fill += sys:: nonzero_size_of :: < T > ( ) ;
1355
- let p = to_unsafe_ptr ( & ( ( * * repr) . data . data ) ) ;
1356
- let p = ptr:: offset ( p, fill as int ) as * mut T ;
1357
- intrinsics:: move_val_init ( & mut ( * p) , t) ;
1358
- } else {
1359
- let repr: * * mut Vec < u8 > = cast:: transmute ( this) ;
1360
- let fill = ( * * repr) . fill ;
1361
- ( * * repr) . fill += sys:: nonzero_size_of :: < T > ( ) ;
1362
- let p = to_unsafe_ptr ( & ( ( * * repr) . data ) ) ;
1363
- let p = ptr:: offset ( p, fill as int ) as * mut T ;
1364
- intrinsics:: move_val_init ( & mut ( * p) , t) ;
1365
- }
1351
+ // This doesn't bother to make sure we have space.
1352
+ #[ inline] // really pretty please
1353
+ unsafe fn push_fast ( & mut self , t : T ) {
1354
+ if contains_managed :: < T > ( ) {
1355
+ let repr: * * mut Box < Vec < u8 > > = cast:: transmute ( self ) ;
1356
+ let fill = ( * * repr) . data . fill ;
1357
+ ( * * repr) . data . fill += sys:: nonzero_size_of :: < T > ( ) ;
1358
+ let p = to_unsafe_ptr ( & ( ( * * repr) . data . data ) ) ;
1359
+ let p = ptr:: offset ( p, fill as int ) as * mut T ;
1360
+ intrinsics:: move_val_init ( & mut ( * p) , t) ;
1361
+ } else {
1362
+ let repr: * * mut Vec < u8 > = cast:: transmute ( self ) ;
1363
+ let fill = ( * * repr) . fill ;
1364
+ ( * * repr) . fill += sys:: nonzero_size_of :: < T > ( ) ;
1365
+ let p = to_unsafe_ptr ( & ( ( * * repr) . data ) ) ;
1366
+ let p = ptr:: offset ( p, fill as int ) as * mut T ;
1367
+ intrinsics:: move_val_init ( & mut ( * p) , t) ;
1366
1368
}
1367
-
1368
1369
}
1369
1370
1370
1371
/// Takes ownership of the vector `rhs`, moving all elements into
0 commit comments