A few tests for infinite loops

This commit is contained in:
Tim Chevalier 2012-03-11 20:17:27 -07:00
parent a0a230de83
commit 813c41362b
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,13 @@
// error-pattern:some control paths may return
/* Make sure a loop{} with a break in it can't be
the tailexpr in the body of a diverging function */
fn forever() -> ! {
loop {
break;
}
ret 42;
}
fn main() {
if (1 == 2) { forever(); }
}

View File

@ -0,0 +1,10 @@
/* Make sure a loop{} can be the tailexpr in the body
of a diverging function */
fn forever() -> ! {
loop{}
}
fn main() {
if (1 == 2) { forever(); }
}