Skip to content

Commit 467ce26

Browse files
committed
Include the "unwind" crate to link with libunwind instead of the "libc" crate.
1 parent 71042b4 commit 467ce26

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Diff for: tests/ui/extern-flag/auxiliary/panic_handler.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
#![feature(lang_items)]
1+
#![feature(lang_items, panic_unwind)]
22
#![no_std]
33

4-
// Since `rustc` generally passes `-nodefaultlibs` to the linker,
5-
// Rust programs link necessary system libraries via `#[link()]`
6-
// attributes in the `libc` crate. `libc` is a dependency of `std`,
7-
// but as we are `#![no_std]`, we need to include it manually.
8-
// Except on windows-msvc.
9-
#![feature(rustc_private)]
10-
#[cfg(not(all(windows, target_env = "msvc")))]
11-
extern crate libc;
4+
// Since the `unwind` crate is a dependency of the `std` crate, and we have
5+
// `#![no_std]`, the unwinder is not included in the link command by default.
6+
// We need to include crate `unwind` manually.
7+
extern crate unwind;
128

139
#[panic_handler]
1410
pub fn begin_panic_handler(_info: &core::panic::PanicInfo<'_>) -> ! {

0 commit comments

Comments
 (0)