1 // Regression test for issue #105637: `-Zdylib-lto` with LTO duplicated symbols from other dylibs,
2 // in this case from libstd.
4 // That manifested as both `rustc_driver` and rustc's "main" (`compiler/rustc`) having their own
5 // `std::panicking::HOOK` static, and the hook in rustc's main (the default stdlib's) being executed
6 // when rustc ICEs, instead of the overriden hook from `rustc_driver` (which also displays the query
7 // stack and information on how to open a GH issue for the encountered ICE).
9 // In this test, we reproduce this setup by installing a panic hook in both the main and an LTOed
10 // dylib: the last hook set should be the one being executed, the dylib's.
12 // aux-build: thinlto-dylib.rs
16 extern crate thinlto_dylib;
21 // We don't want to see this panic hook executed
22 std::panic::set_hook(Box::new(|_| {
23 eprintln!("main crate panic hook");
26 // Have the LTOed dylib install its own hook and panic, we want to see its hook executed.
27 thinlto_dylib::main();