]> git.lizzy.rs Git - rust.git/blob - src/test/ui/panic-runtime/lto-unwind.rs
Rollup merge of #61207 - taiki-e:arbitrary_self_types-lifetime-elision-2, r=Centril
[rust.git] / src / test / ui / panic-runtime / lto-unwind.rs
1 // run-pass
2 #![allow(unused_variables)]
3
4 // compile-flags:-C lto -C panic=unwind
5 // no-prefer-dynamic
6 // ignore-cloudabi no processes
7 // ignore-emscripten no processes
8 // ignore-sgx no processes
9
10 use std::process::Command;
11 use std::env;
12
13 struct Bomb;
14
15 impl Drop for Bomb {
16     fn drop(&mut self) {
17         println!("hurray you ran me");
18     }
19 }
20
21 fn main() {
22     let mut args = env::args_os();
23     let me = args.next().unwrap();
24
25     if let Some(s) = args.next() {
26         if &*s == "foo" {
27
28             let _bomb = Bomb;
29
30             panic!("try to catch me");
31         }
32     }
33     let s = Command::new(env::args_os().next().unwrap()).arg("foo").output();
34     let s = s.unwrap();
35     assert!(!s.status.success());
36     assert!(String::from_utf8_lossy(&s.stdout).contains("hurray you ran me"));
37 }