2019-07-26 21:54:25 +00:00
|
|
|
// run-pass
|
2021-12-03 15:32:51 +00:00
|
|
|
// needs-unwind
|
2016-02-11 11:34:41 +00:00
|
|
|
// ignore-emscripten no threads support
|
2013-10-23 08:49:18 +00:00
|
|
|
|
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
|
|
|
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2015-02-17 23:24:34 +00:00
|
|
|
use std::thread;
|
2013-05-25 02:35:29 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
fn test_break() { loop { let _x: Box<isize> = break; } }
|
2011-08-23 22:45:24 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
fn test_cont() { let mut i = 0; while i < 1 { i += 1; let _x: Box<isize> = continue; } }
|
2011-08-23 22:45:24 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
fn test_ret() { let _x: Box<isize> = return; }
|
2011-08-23 22:45:24 +00:00
|
|
|
|
2014-10-09 19:17:22 +00:00
|
|
|
fn test_panic() {
|
2015-03-26 00:06:52 +00:00
|
|
|
fn f() { let _x: Box<isize> = panic!(); }
|
2016-05-06 23:32:18 +00:00
|
|
|
thread::spawn(move|| f() ).join().unwrap_err();
|
2011-08-23 22:45:24 +00:00
|
|
|
}
|
|
|
|
|
2014-10-09 19:17:22 +00:00
|
|
|
fn test_panic_indirect() {
|
|
|
|
fn f() -> ! { panic!(); }
|
2015-03-26 00:06:52 +00:00
|
|
|
fn g() { let _x: Box<isize> = f(); }
|
2016-05-06 23:32:18 +00:00
|
|
|
thread::spawn(move|| g() ).join().unwrap_err();
|
2011-08-23 22:45:24 +00:00
|
|
|
}
|
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2011-08-23 22:45:24 +00:00
|
|
|
test_break();
|
|
|
|
test_cont();
|
|
|
|
test_ret();
|
2014-10-09 19:17:22 +00:00
|
|
|
test_panic();
|
|
|
|
test_panic_indirect();
|
2011-09-02 22:34:58 +00:00
|
|
|
}
|