2011-09-23 11:33:11 +02:00
|
|
|
// xfail-pretty
|
|
|
|
|
2011-09-21 12:40:27 +02:00
|
|
|
fn id(x: bool) -> bool { x }
|
|
|
|
|
|
|
|
fn call_id() {
|
|
|
|
let c <- fail;
|
|
|
|
id(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn call_id_2() { id(true) && id(ret); }
|
|
|
|
|
|
|
|
fn call_id_3() { id(ret) && id(ret); }
|
|
|
|
|
|
|
|
fn call_id_4() { while id(break) { } }
|
|
|
|
|
2011-09-25 21:01:50 -07:00
|
|
|
fn bind_id_1() { bind id(fail); }
|
|
|
|
|
|
|
|
fn bind_id_2() { bind id(ret); }
|
|
|
|
|
2011-09-25 20:57:44 -07:00
|
|
|
fn fail_fail() { fail fail; }
|
|
|
|
|
2011-12-22 17:53:53 -08:00
|
|
|
fn log_fail() { log(error, fail); }
|
2011-09-21 12:40:27 +02:00
|
|
|
|
2011-12-22 17:53:53 -08:00
|
|
|
fn log_ret() { log(error, ret); }
|
2011-09-23 15:01:19 -07:00
|
|
|
|
2012-03-09 16:11:56 -08:00
|
|
|
fn log_break() { loop { log(error, break); } }
|
2011-09-23 15:01:19 -07:00
|
|
|
|
2011-12-22 17:53:53 -08:00
|
|
|
fn log_cont() { do { log(error, cont); } while false }
|
2011-09-23 15:01:19 -07:00
|
|
|
|
2011-09-21 12:40:27 +02:00
|
|
|
fn ret_ret() -> int { ret (ret 2) + 3; }
|
|
|
|
|
|
|
|
fn ret_guard() {
|
2012-02-15 09:40:42 +01:00
|
|
|
alt check 2 {
|
2012-01-09 19:15:17 -06:00
|
|
|
x if (ret) { x; }
|
2011-09-21 12:40:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-24 21:24:47 -07:00
|
|
|
fn rec_ret() { let _r: {c: int} = {c: ret}; }
|
2011-09-27 11:05:16 -07:00
|
|
|
|
2012-03-24 21:24:47 -07:00
|
|
|
fn vec_ret() { let _v: [int] = [1, 2, ret, 4]; }
|
2011-09-27 11:05:16 -07:00
|
|
|
|
2011-09-21 12:40:27 +02:00
|
|
|
fn fail_then_concat() {
|
2012-03-22 08:39:41 -07:00
|
|
|
let mut x = [], y = [3];
|
2011-09-21 12:40:27 +02:00
|
|
|
fail;
|
|
|
|
x += y;
|
|
|
|
"good" + "bye";
|
|
|
|
}
|
|
|
|
|
2011-09-27 11:05:16 -07:00
|
|
|
fn main() {
|
|
|
|
// Call the functions that don't fail.
|
|
|
|
rec_ret();
|
|
|
|
vec_ret();
|
|
|
|
ret_ret();
|
|
|
|
log_ret();
|
|
|
|
call_id_2();
|
|
|
|
call_id_3();
|
|
|
|
call_id_4();
|
|
|
|
bind_id_2();
|
|
|
|
ret_guard();
|
|
|
|
}
|