Merge rust-bitcoin/rust-bitcoin#1814: embedded: Remove error handler

d37845197f embedded: Remove error handler (Tobin C. Harding)

Pull request description:

  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

  Fix: #1813

ACKs for top commit:
  Kixunil:
    ACK d37845197f
  apoelstra:
    ACK d37845197f

Tree-SHA512: 76ce3f346e7e4e62595c6a6c415476b0cabcf27ded8e79a3e0b692a98b12ff9e90bec2841d18790bb62a16c553ad60492fc09e1aa4bf550c7070cd29b5ac1702
This commit is contained in:
Andrew Poelstra 2023-04-26 14:48:46 +00:00
commit db12853ac2
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
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 {}
}