embedded: Remove error handler

Seems we no longer need an explicit error handler, remove it.

I did not grok the reason (long thread link below) but just removed it
and checked that the embedded crates still ran correctly.

https://github.com/rust-lang/rust/issues/51540)
This commit is contained in:
Tobin C. Harding 2023-04-26 14:29:29 +10:00
parent 967b58dc2a
commit d37845197f
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
2 changed files with 0 additions and 23 deletions

View File

@ -8,7 +8,6 @@ extern crate bitcoin;
use alloc::string::ToString; use alloc::string::ToString;
use alloc::vec; use alloc::vec;
use core::alloc::Layout;
use core::panic::PanicInfo; use core::panic::PanicInfo;
use alloc_cortex_m::CortexMHeap; use alloc_cortex_m::CortexMHeap;
@ -17,7 +16,6 @@ use bitcoin::{Address, Network, PrivateKey};
use bitcoin::secp256k1::ffi::types::AlignedType; use bitcoin::secp256k1::ffi::types::AlignedType;
use bitcoin::secp256k1::Secp256k1; use bitcoin::secp256k1::Secp256k1;
use cortex_m::asm;
use cortex_m_rt::entry; use cortex_m_rt::entry;
use cortex_m_semihosting::{debug, hprintln}; use cortex_m_semihosting::{debug, hprintln};
@ -57,16 +55,6 @@ fn main() -> ! {
loop {} loop {}
} }
// define what happens in an Out Of Memory (OOM) condition
#[alloc_error_handler]
fn alloc_error(_layout: Layout) -> ! {
hprintln!("alloc error").unwrap();
debug::exit(debug::EXIT_FAILURE);
asm::bkpt();
loop {}
}
#[inline(never)] #[inline(never)]
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {

View File

@ -7,8 +7,6 @@ extern crate bitcoin_hashes;
#[cfg(feature = "alloc")] extern crate alloc; #[cfg(feature = "alloc")] extern crate alloc;
#[cfg(feature = "alloc")] use alloc_cortex_m::CortexMHeap; #[cfg(feature = "alloc")] use alloc_cortex_m::CortexMHeap;
#[cfg(feature = "alloc")] use core::alloc::Layout;
#[cfg(feature = "alloc")] use cortex_m::asm;
#[cfg(feature = "alloc")] use alloc::string::ToString; #[cfg(feature = "alloc")] use alloc::string::ToString;
use bitcoin_hashes::{sha256, Hash, HashEngine}; use bitcoin_hashes::{sha256, Hash, HashEngine};
@ -63,12 +61,3 @@ fn check_result(engine: sha256::HashEngine) {
debug::exit(debug::EXIT_FAILURE); debug::exit(debug::EXIT_FAILURE);
} }
} }
// define what happens in an Out Of Memory (OOM) condition
#[cfg(feature = "alloc")]
#[alloc_error_handler]
fn alloc_error(_layout: Layout) -> ! {
asm::bkpt();
loop {}
}