2012-12-11 01:32:48 +00:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2011-10-19 23:50:03 +00:00
|
|
|
// xfail-win32 leaks
|
2011-08-23 22:45:24 +00:00
|
|
|
// Issue #787
|
2012-03-11 04:38:03 +00:00
|
|
|
// Don't try to clean up uninitialized locals
|
2011-08-23 22:45:24 +00:00
|
|
|
|
2012-09-12 00:46:20 +00:00
|
|
|
extern mod std;
|
2011-08-23 22:45:24 +00:00
|
|
|
|
2012-03-10 00:11:56 +00:00
|
|
|
fn test_break() { loop { let x: @int = break; } }
|
2011-08-23 22:45:24 +00:00
|
|
|
|
2012-09-07 22:32:04 +00:00
|
|
|
fn test_cont() { let mut i = 0; while i < 1 { i += 1; let x: @int = loop; } }
|
2011-08-23 22:45:24 +00:00
|
|
|
|
2012-08-02 00:30:05 +00:00
|
|
|
fn test_ret() { let x: @int = return; }
|
2011-08-23 22:45:24 +00:00
|
|
|
|
|
|
|
fn test_fail() {
|
2013-02-01 01:51:01 +00:00
|
|
|
fn f() { let x: @int = die!(); }
|
2012-06-30 23:19:07 +00:00
|
|
|
task::try(|| f() );
|
2011-08-23 22:45:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn test_fail_indirect() {
|
2013-02-01 01:51:01 +00:00
|
|
|
fn f() -> ! { die!(); }
|
2012-02-19 00:34:42 +00:00
|
|
|
fn g() { let x: @int = f(); }
|
2012-06-30 23:19:07 +00:00
|
|
|
task::try(|| g() );
|
2011-08-23 22:45:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
test_break();
|
|
|
|
test_cont();
|
|
|
|
test_ret();
|
|
|
|
test_fail();
|
|
|
|
test_fail_indirect();
|
2011-09-02 22:34:58 +00:00
|
|
|
}
|