Remove ret_style and instead check whether fn return type is bot
cc #3681
This commit is contained in:
parent
80435ad429
commit
9f7dc1cb33
24 changed files with 70 additions and 145 deletions
|
|
@ -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); }
|
||||
|
|
|
|||
|
|
@ -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); }
|
||||
|
|
|
|||
|
|
@ -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() { }
|
||||
|
|
|
|||
7
src/test/compile-fail/closure-that-fails.rs
Normal file
7
src/test/compile-fail/closure-that-fails.rs
Normal 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
|
||||
}
|
||||
|
|
@ -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() { }
|
||||
|
|
|
|||
|
|
@ -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() { }
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ fn forever() -> ! {
|
|||
loop {
|
||||
break;
|
||||
}
|
||||
return 42i; //~ ERROR expected `_|_` but found `int`
|
||||
return 42i; //~ ERROR expected `!` but found `int`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue