Patch that makes panic = abort whin libcore is compiled with feature=trivial_panic
| diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs | |
| index 0b8a523..e7fd6e9 100644 | |
| --- a/src/libcore/panicking.rs | |
| +++ b/src/libcore/panicking.rs | |
| @@ -33,6 +33,7 @@ | |
| use fmt; | |
| #[cold] #[inline(never)] // this is the slow path, always | |
| +#[cfg(not(feature = "trivial_panic"))] | |
| #[lang="panic"] | |
| pub fn panic(expr_file_line: &(&'static str, &'static str, u32)) -> ! { | |
| // Use Arguments::new_v1 instead of format_args!("{}", expr) to potentially | |
| @@ -45,7 +46,15 @@ pub fn panic(expr_file_line: &(&'static str, &'static str, u32)) -> ! { | |
| panic_fmt(fmt::Arguments::new_v1(&[expr], &[]), &(file, line)) | |
| } | |
| +#[cold] #[inline(never)] // this is the slow path, always | |
| +#[cfg(feature = "trivial_panic")] | |
| +#[lang="panic"] | |
| +pub fn panic(_expr_file_line: &(&'static str, &'static str, u32)) -> ! { | |
| + unsafe { ::core::intrinsics::abort(); } | |
| +} | |
| + | |
| #[cold] #[inline(never)] | |
| +#[cfg(not(feature = "trivial_panic"))] | |
| #[lang="panic_bounds_check"] | |
| fn panic_bounds_check(file_line: &(&'static str, u32), | |
| index: usize, len: usize) -> ! { | |
| @@ -54,6 +63,14 @@ fn panic_bounds_check(file_line: &(&'static str, u32), | |
| } | |
| #[cold] #[inline(never)] | |
| +#[cfg(feature = "trivial_panic")] | |
| +#[lang="panic_bounds_check"] | |
| +fn panic_bounds_check(_file_line: &(&'static str, u32), | |
| + _index: usize, _len: usize) -> ! { | |
| + unsafe { ::core::intrinsics::abort(); } | |
| +} | |
| + | |
| +#[cold] #[inline(never)] | |
| pub fn panic_fmt(fmt: fmt::Arguments, file_line: &(&'static str, u32)) -> ! { | |
| #[allow(improper_ctypes)] | |
| extern { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment