Remove ret_style and instead check whether fn return type is bot

cc #3681
This commit is contained in:
Niko Matsakis 2013-01-08 06:21:19 -08:00
parent 80435ad429
commit 9f7dc1cb33
24 changed files with 70 additions and 145 deletions

View file

@ -13,7 +13,7 @@
fn bad_bang(i: uint) -> ! {
return 7u;
//~^ ERROR expected `_|_` but found `uint`
//~^ ERROR expected `!` but found `uint`
}
fn main() { bad_bang(5u); }

View file

@ -13,7 +13,7 @@
fn bad_bang(i: uint) -> ! {
if i < 0u { } else { fail; }
//~^ ERROR expected `_|_` but found `()`
//~^ ERROR expected `!` but found `()`
}
fn main() { bad_bang(5u); }

View file

@ -9,6 +9,6 @@
// except according to those terms.
fn f() -> ! {
3i //~ ERROR expected `_|_` but found `int`
3i //~ ERROR expected `!` but found `int`
}
fn main() { }

View file

@ -0,0 +1,7 @@
fn foo(f: fn() -> !) {}
fn main() {
// Type inference didn't use to be able to handle this:
foo(|| fail);
foo(|| 22); //~ ERROR mismatched types
}

View file

@ -10,7 +10,7 @@
fn g() -> ! { fail; }
fn f() -> ! {
return 42i; //~ ERROR expected `_|_` but found `int`
return 42i; //~ ERROR expected `!` but found `int`
g(); //~ WARNING unreachable statement
}
fn main() { }

View file

@ -9,7 +9,7 @@
// except according to those terms.
fn f() -> ! {
return 42i; //~ ERROR expected `_|_` but found `int`
return 42i; //~ ERROR expected `!` but found `int`
fail; //~ WARNING unreachable statement
}
fn main() { }

View file

@ -14,7 +14,7 @@ fn forever() -> ! {
loop {
break;
}
return 42i; //~ ERROR expected `_|_` but found `int`
return 42i; //~ ERROR expected `!` but found `int`
}
fn main() {