2019-07-27 00:54:25 +03:00
|
|
|
// run-pass
|
2014-05-19 09:30:09 -07:00
|
|
|
// aux-build:weak-lang-items.rs
|
|
|
|
|
2016-02-11 12:34:41 +01:00
|
|
|
// ignore-emscripten no threads support
|
2015-03-22 13:13:15 -07:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2015-03-27 10:22:44 -07:00
|
|
|
extern crate weak_lang_items as other;
|
2014-05-19 09:30:09 -07:00
|
|
|
|
|
|
|
fn main() {
|
2023-07-11 11:27:51 +02:00
|
|
|
let _ = std::thread::spawn(move || {
|
|
|
|
// The goal of the test is just to make sure other::foo() is called. Since the function
|
|
|
|
// panics, it's executed in its own thread. That way, the panic is isolated within the
|
|
|
|
// thread and wont't affect the overall exit code.
|
|
|
|
//
|
|
|
|
// That causes a spurious failures in panic=abort targets though: if the program exits
|
|
|
|
// before the thread is fully initialized the test will pass, but if the thread gets
|
|
|
|
// executed first the whole program will abort. Adding a 60 seconds sleep will (hopefully!)
|
|
|
|
// ensure the program always exits before the thread is executed.
|
|
|
|
std::thread::sleep(std::time::Duration::from_secs(60));
|
|
|
|
|
2014-05-19 09:30:09 -07:00
|
|
|
other::foo()
|
|
|
|
});
|
|
|
|
}
|