about summary refs log tree commit diff
diff options
context:
space:
mode:
authorXing Xue <xingxue@outlook.com>2024-11-11 10:31:29 -0500
committerXing Xue <xingxue@outlook.com>2024-11-14 10:51:28 -0500
commit467ce2695a9efca6f2494be680e922ac541df2e3 (patch)
treee818a0d87e34c1344931b4a423b3c87d6b43afa1
parent71042b4b201a432b426304f511b3169850ed8923 (diff)
downloadrust-467ce2695a9efca6f2494be680e922ac541df2e3.tar.gz
rust-467ce2695a9efca6f2494be680e922ac541df2e3.zip
Include the "unwind" crate to link with libunwind instead of the "libc" crate.
-rw-r--r--tests/ui/extern-flag/auxiliary/panic_handler.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/tests/ui/extern-flag/auxiliary/panic_handler.rs b/tests/ui/extern-flag/auxiliary/panic_handler.rs
index 5ca32fa992b..9140ceed229 100644
--- a/tests/ui/extern-flag/auxiliary/panic_handler.rs
+++ b/tests/ui/extern-flag/auxiliary/panic_handler.rs
@@ -1,14 +1,10 @@
-#![feature(lang_items)]
+#![feature(lang_items, panic_unwind)]
 #![no_std]
 
-// Since `rustc` generally passes `-nodefaultlibs` to the linker,
-// Rust programs link necessary system libraries via `#[link()]`
-// attributes in the `libc` crate. `libc` is a dependency of `std`,
-// but as we are `#![no_std]`, we need to include it manually.
-// Except on windows-msvc.
-#![feature(rustc_private)]
-#[cfg(not(all(windows, target_env = "msvc")))]
-extern crate libc;
+// Since the `unwind` crate is a dependency of the `std` crate, and we have
+// `#![no_std]`, the unwinder is not included in the link command by default.
+// We need to include crate `unwind` manually.
+extern crate unwind;
 
 #[panic_handler]
 pub fn begin_panic_handler(_info: &core::panic::PanicInfo<'_>) -> ! {