Skip to content

Commit 0ec4796

Browse files
committed
---
yaml --- r: 104906 b: refs/heads/snap-stage3 c: e4c91e6 h: refs/heads/master v: v3
1 parent dd4e798 commit 0ec4796

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 62f1d68439dcfd509eaca29887afa97f22938373
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: e2ebc8f81138bcad019f43a3af0cddb0dc0dcfbc
4+
refs/heads/snap-stage3: e4c91e6c7cfc03246a422576ab41ac74125fd3b8
55
refs/heads/try: db814977d07bd798feb24f6b74c00800ef458a13
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/vec_ng.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,7 @@ impl<T> Vec<T> {
415415
unsafe { // infallible
416416
// The spot to put the new value
417417
{
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);
420419
// Shift everything over to make space. (Duplicating the
421420
// `index`th element into two consecutive places.)
422421
ptr::copy_memory(p.offset(1), &*p, len - index);
@@ -434,9 +433,8 @@ impl<T> Vec<T> {
434433
unsafe { // infallible
435434
let ret;
436435
{
437-
let slice = self.as_mut_slice();
438436
// 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);
440438
// copy it out, unsafely having a copy of the value on
441439
// the stack and in the vector at the same time.
442440
ret = Some(ptr::read(ptr as *T));
@@ -499,6 +497,11 @@ impl<T> Vec<T> {
499497
pub fn as_ptr(&self) -> *T {
500498
self.as_slice().as_ptr()
501499
}
500+
501+
#[inline]
502+
pub fn as_mut_ptr(&mut self) -> *mut T {
503+
self.as_mut_slice().as_mut_ptr()
504+
}
502505
}
503506

504507
impl<T> Mutable for Vec<T> {

0 commit comments

Comments
 (0)