auto merge of #6223 : alexcrichton/rust/issue-6183, r=pcwalton
Closes #6183. The first commit changes the compiler's method of treating a `for` loop, and all the remaining commits are just dealing with the fallout. The biggest fallout was the `IterBytes` trait, although it's really a whole lot nicer now because all of the `iter_bytes_XX` methods are just and-ed together. Sadly there was a huge amount of stuff that's `cfg(stage0)` gated, but whoever lands the next snapshot is going to have a lot of fun deleting all this code!
This commit is contained in:
commit
3e0400fb86
73 changed files with 2948 additions and 309 deletions
|
|
@ -11,4 +11,5 @@
|
|||
fn main() {
|
||||
fn baz(_x: &fn(y: int) -> int) {}
|
||||
for baz |_e| { } //~ ERROR A `for` loop iterator should expect a closure that returns `bool`
|
||||
//~^ ERROR expected `for` closure to return `bool`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
fn borrow(_v: &int) {}
|
||||
fn borrow_mut(_v: &mut int) {}
|
||||
fn cond() -> bool { fail!() }
|
||||
fn for_func(_f: &fn() -> bool) { fail!() }
|
||||
fn for_func(_f: &fn() -> bool) -> bool { fail!() }
|
||||
fn produce<T>() -> T { fail!(); }
|
||||
|
||||
fn inc(v: &mut ~int) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn not_bool(f: &fn(int) -> ~str) {}
|
||||
fn not_bool(f: &fn(int) -> ~str) -> bool {}
|
||||
|
||||
fn main() {
|
||||
for uint::range(0, 100000) |_i| { //~ ERROR A for-loop body must return (), but
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ fn uuid_random() -> uint { fail!(); }
|
|||
|
||||
fn main() {
|
||||
do uint::range(0, 100000) |_i| { //~ ERROR Do-block body must return bool, but
|
||||
}
|
||||
};
|
||||
// should get a more general message if the callback
|
||||
// doesn't return nil
|
||||
do uint::range(0, 100000) |_i| { //~ ERROR mismatched types
|
||||
~"str"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
do 5.times {} //~ ERROR Do-block body must return bool, but returns () here. Perhaps
|
||||
do 5.times {}; //~ ERROR Do-block body must return bool, but returns () here. Perhaps
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@
|
|||
|
||||
fn main() {
|
||||
for task::spawn { return true; } //~ ERROR A `for` loop iterator should expect a closure that
|
||||
//~^ ERROR expected `for` closure to return `bool`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ mod kitties {
|
|||
}
|
||||
|
||||
pub impl cat {
|
||||
priv fn nap(&self) { uint::range(1u, 10000u, |_i| false)}
|
||||
priv fn nap(&self) { uint::range(1u, 10000u, |_i| false); }
|
||||
}
|
||||
|
||||
pub fn cat(in_x : uint, in_y : int) -> cat {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue