6 releases

Uses old Rust 2015

0.3.2 Oct 16, 2019
0.3.1 Sep 9, 2018
0.2.0 Jun 4, 2018
0.1.1 Apr 9, 2018

#205 in No standard library

Download history 281/week @ 2023-11-20 338/week @ 2023-11-27 199/week @ 2023-12-04 337/week @ 2023-12-11 351/week @ 2023-12-18 124/week @ 2023-12-25 178/week @ 2024-01-01 251/week @ 2024-01-08 268/week @ 2024-01-15 282/week @ 2024-01-22 180/week @ 2024-01-29 227/week @ 2024-02-05 305/week @ 2024-02-12 161/week @ 2024-02-19 262/week @ 2024-02-26 343/week @ 2024-03-04

1,094 downloads per month
Used in 15 crates (13 directly)

MIT/Apache

8KB

panic-abort

Set the panicking behavior to abort

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

Set the panicking behavior to abort

This crate contains an implementation of panic_fmt that simply calls intrinsics::abort.

Behavior

As of Rust 1.38.0, intrinsics::abort lowers to a trap instruction on most architectures; on some architectures it simply lowers to call to the abort function (unmangled name). The exact behavior of intrinsics::abort is architecture and system dependent.

On bare-metal (no OS) systems the trap instruction usually causes a hardware exception to be raised in a synchronous fashion -- hardware exceptions have nothing to do with C++ exceptions and are closer in semantics to POSIX signals (see man 7 signals on UNIX-y systems).

On hosted applications (applications running under an OS), the trap instruction usually terminates the whole process with an exit code that corresponds to SIGILL unless a signal handler that handles this particular signal was registered (again, see man 7 signals on UNIX-y systems).

HEADS UP Because intrinsics::abort is an unstable API its semantics could change in any new Rust release (minor or patch release).

Usage

#![no_std]

extern crate panic_abort;

fn main() {
    panic!("argument is ignored");
}

No runtime deps