File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
branches/snap-stage3/src/libstd Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 62f1d68439dcfd509eaca29887afa97f22938373
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: e2ebc8f81138bcad019f43a3af0cddb0dc0dcfbc
4
+ refs/heads/snap-stage3: e4c91e6c7cfc03246a422576ab41ac74125fd3b8
5
5
refs/heads/try: db814977d07bd798feb24f6b74c00800ef458a13
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
Original file line number Diff line number Diff line change @@ -415,8 +415,7 @@ impl<T> Vec<T> {
415
415
unsafe { // infallible
416
416
// The spot to put the new value
417
417
{
418
- let slice = self . as_mut_slice ( ) ;
419
- let p = slice. as_mut_ptr ( ) . offset ( index as int ) ;
418
+ let p = self . as_mut_ptr ( ) . offset ( index as int ) ;
420
419
// Shift everything over to make space. (Duplicating the
421
420
// `index`th element into two consecutive places.)
422
421
ptr:: copy_memory ( p. offset ( 1 ) , & * p, len - index) ;
@@ -434,9 +433,8 @@ impl<T> Vec<T> {
434
433
unsafe { // infallible
435
434
let ret;
436
435
{
437
- let slice = self . as_mut_slice ( ) ;
438
436
// the place we are taking from.
439
- let ptr = slice . as_mut_ptr ( ) . offset ( index as int ) ;
437
+ let ptr = self . as_mut_ptr ( ) . offset ( index as int ) ;
440
438
// copy it out, unsafely having a copy of the value on
441
439
// the stack and in the vector at the same time.
442
440
ret = Some ( ptr:: read ( ptr as * T ) ) ;
@@ -499,6 +497,11 @@ impl<T> Vec<T> {
499
497
pub fn as_ptr ( & self ) -> * T {
500
498
self . as_slice ( ) . as_ptr ( )
501
499
}
500
+
501
+ #[ inline]
502
+ pub fn as_mut_ptr ( & mut self ) -> * mut T {
503
+ self . as_mut_slice ( ) . as_mut_ptr ( )
504
+ }
502
505
}
503
506
504
507
impl < T > Mutable for Vec < T > {
You can’t perform that action at this time.
0 commit comments