]> git.lizzy.rs Git - rust.git/blob - tests/ui/panic-runtime/lto-abort.rs
Rollup merge of #106661 - mjguzik:linux_statx, r=Mark-Simulacrum
[rust.git] / tests / ui / panic-runtime / lto-abort.rs
1 // run-pass
2 #![allow(unused_variables)]
3 // compile-flags:-C lto -C panic=abort
4 // no-prefer-dynamic
5 // ignore-emscripten no processes
6 // ignore-sgx no processes
7
8 use std::process::Command;
9 use std::env;
10
11 struct Bomb;
12
13 impl Drop for Bomb {
14     fn drop(&mut self) {
15         std::process::exit(0);
16     }
17 }
18
19 fn main() {
20     let mut args = env::args_os();
21     let me = args.next().unwrap();
22
23     if let Some(s) = args.next() {
24         if &*s == "foo" {
25
26             let _bomb = Bomb;
27
28             panic!("try to catch me");
29         }
30     }
31     let s = Command::new(env::args_os().next().unwrap()).arg("foo").status();
32     assert!(s.unwrap().code() != Some(0));
33 }