Skip to content

Commit 640ce39

Browse files
committed
delegate panic_abort to a crate
1 parent 2230557 commit 640ce39

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ lto = true
2121

2222
[dependencies]
2323
rlibc = "*"
24+
panic-abort = "0.3.1"
2425

2526
[build-dependencies]
2627
bindgen = "0.37.0"

src/lang_items.rs

-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
use core::intrinsics::abort;
2-
use core::panic::PanicInfo;
3-
4-
#[panic_handler]
5-
fn panic(_info: &PanicInfo) -> ! {
6-
unsafe {
7-
abort();
8-
}
9-
}
10-
111
pub enum c_void {}
122
pub type c_char = i8;
133
pub type c_int = i32;

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![allow(non_snake_case)]
55
#![feature(core_intrinsics)]
66

7-
use core::intrinsics::abort;
7+
extern crate panic_abort;
88

99
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
1010

@@ -35,7 +35,7 @@ pub extern "C" fn main() -> ! {
3535
}
3636

3737
gfxExit();
38-
abort();
38+
panic!("Success. We shall however think on a way of exiting cleanly.");
3939
}
4040
}
4141

0 commit comments

Comments
 (0)