De-mode vec::each() and many of the str iteration routines

Note that the method foo.each() is not de-moded, nor the other
vec routines.
This commit is contained in:
Niko Matsakis 2012-09-18 21:41:37 -07:00
parent 62b7f4d800
commit 9cf271fe96
81 changed files with 556 additions and 750 deletions

View file

@ -1,6 +1,6 @@
fn want_slice(v: &[int]) -> int {
let mut sum = 0;
for vec::each(v) |i| { sum += i; }
for vec::each(v) |i| { sum += *i; }
return sum;
}

View file

@ -1,5 +1,5 @@
fn main() {
do vec::iter(fail) |i| {
for vec::each(fail) |i| {
log (debug, i * 2);
//~^ ERROR the type of this value must be known
};

View file

@ -1,5 +1,6 @@
fn main() {
let a: ~[int] = ~[];
vec::each(a, fn@(_x: int) -> bool { //~ ERROR not all control paths return a value
vec::each(a, fn@(_x: &int) -> bool {
//~^ ERROR not all control paths return a value
});
}

View file

@ -2,9 +2,9 @@ fn concat<T: Copy>(v: ~[const ~[const T]]) -> ~[T] {
let mut r = ~[];
// Earlier versions of our type checker accepted this:
vec::iter(v, |&&inner: ~[T]| {
vec::each(v, |inner: &~[T]| {
//~^ ERROR values differ in mutability
r += inner;
r += *inner; true
});
return r;