Move dummy panic handler to lib as well
This commit is contained in:
parent
6e74064c7f
commit
af45cc8701
@ -23,6 +23,7 @@ personality-dummy = []
|
||||
print = ["libc"]
|
||||
panic = ["alloc"]
|
||||
panic-handler = ["print", "panic"]
|
||||
panic-handler-dummy = []
|
||||
system-alloc = []
|
||||
default = ["dwarf-expr", "hide-trace", "fde-phdr", "fde-registry"]
|
||||
|
||||
|
@ -8,5 +8,5 @@ edition = "2018"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
unwind = { path = "../", features = ["system-alloc", "personality-dummy"] }
|
||||
unwind = { path = "../", features = ["system-alloc", "personality-dummy", "panic-handler-dummy"] }
|
||||
libc = "0.2"
|
||||
|
@ -1,17 +1,8 @@
|
||||
#![no_std]
|
||||
#![feature(default_alloc_error_handler)]
|
||||
#![feature(lang_items)]
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![warn(unsafe_op_in_unsafe_fn)]
|
||||
|
||||
// Keep this explicit
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate unwind;
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(_info: &PanicInfo<'_>) -> ! {
|
||||
// `unwind` crate should never panic.
|
||||
unsafe { core::hint::unreachable_unchecked() }
|
||||
}
|
||||
|
@ -5,7 +5,10 @@
|
||||
any(feature = "personality", feature = "personality-dummy"),
|
||||
feature(lang_items)
|
||||
)]
|
||||
#![cfg_attr(feature = "panic", feature(core_intrinsics))]
|
||||
#![cfg_attr(
|
||||
any(feature = "panic", feature = "panic-handler-dummy"),
|
||||
feature(core_intrinsics)
|
||||
)]
|
||||
#![cfg_attr(feature = "panic-handler", feature(thread_local))]
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![warn(unsafe_op_in_unsafe_fn)]
|
||||
@ -34,6 +37,8 @@ pub mod panic;
|
||||
|
||||
#[cfg(feature = "panic-handler")]
|
||||
pub mod panic_handler;
|
||||
#[cfg(feature = "panic-handler-dummy")]
|
||||
pub mod panic_handler_dummy;
|
||||
|
||||
#[cfg(feature = "system-alloc")]
|
||||
mod system_alloc;
|
||||
|
6
src/panic_handler_dummy.rs
Normal file
6
src/panic_handler_dummy.rs
Normal file
@ -0,0 +1,6 @@
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(_info: &PanicInfo<'_>) -> ! {
|
||||
core::intrinsics::abort();
|
||||
}
|
Loading…
Reference in New Issue
Block a user