auto merge of #4998 : thestinger/rust/vec, r=catamorphism

This commit is contained in:
bors 2013-02-18 15:48:34 -08:00
commit ec161edc16
2 changed files with 7 additions and 7 deletions

View file

@ -1865,6 +1865,7 @@ pub trait OwnedVector<T> {
fn consume(self, f: fn(uint, v: T));
fn filter(self, f: fn(t: &T) -> bool) -> ~[T];
fn partition(self, f: pure fn(&T) -> bool) -> (~[T], ~[T]);
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>);
}
impl<T> OwnedVector<T> for ~[T] {
@ -1936,6 +1937,11 @@ impl<T> OwnedVector<T> for ~[T] {
fn partition(self, f: fn(&T) -> bool) -> (~[T], ~[T]) {
partition(self, f)
}
#[inline]
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>) {
grow_fn(self, n, op);
}
}
impl<T> Mutable for ~[T] {
@ -1946,7 +1952,6 @@ impl<T> Mutable for ~[T] {
pub trait OwnedCopyableVector<T: Copy> {
fn push_all(&mut self, rhs: &[const T]);
fn grow(&mut self, n: uint, initval: &T);
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>);
fn grow_set(&mut self, index: uint, initval: &T, val: T);
}
@ -1961,11 +1966,6 @@ impl<T: Copy> OwnedCopyableVector<T> for ~[T] {
grow(self, n, initval);
}
#[inline]
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>) {
grow_fn(self, n, op);
}
#[inline]
fn grow_set(&mut self, index: uint, initval: &T, val: T) {
grow_set(self, index, initval, val);

View file

@ -100,7 +100,7 @@ fn grow<T>(nelts: uint, lo: uint, elts: &mut [Option<T>]) -> ~[Option<T>] {
assert nelts == elts.len();
let mut rv = ~[];
do vec::grow_fn(&mut rv, nelts + 1) |i| {
do rv.grow_fn(nelts + 1) |i| {
let mut element = None;
element <-> elts[(lo + i) % nelts];
element