new cap clause syntax

This commit is contained in:
Niko Matsakis 2012-05-04 12:33:04 -07:00
parent 8affc78e8a
commit 50ec6bd2c3
31 changed files with 447 additions and 360 deletions

View file

@ -1,8 +1,7 @@
// error-pattern:upvars (like 'x') cannot be moved into a closure
fn main() {
let x = 5;
let _y = fn~[move x]() -> int {
let _z = fn~[move x]() -> int { x };
let _y = fn~(move x) -> int {
let _z = fn~(move x) -> int { x }; //! ERROR moving out of upvar
22
};
}

View file

@ -0,0 +1,8 @@
type foo = option<int>;
fn bar(_t: foo) {}
fn main() {
// we used to print foo<int>:
bar(some(3u)); //! ERROR mismatched types: expected `foo`
}

View file

@ -4,7 +4,6 @@ fn concat<T: copy>(v: [const [const T]]) -> [T] {
// Earlier versions of our type checker accepted this:
vec::iter(v) {|&&inner: [T]|
//!^ ERROR values differ in mutability
//!^^ ERROR values differ in mutability
r += inner;
}