Skip to content

Commit

Permalink
Merge #1814: embedded: Remove error handler
Browse files Browse the repository at this point in the history
d378451 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.

  rust-lang/rust#51540

  Fix: #1813

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

Tree-SHA512: 76ce3f346e7e4e62595c6a6c415476b0cabcf27ded8e79a3e0b692a98b12ff9e90bec2841d18790bb62a16c553ad60492fc09e1aa4bf550c7070cd29b5ac1702
  • Loading branch information
apoelstra committed Apr 26, 2023
2 parents 967b58d + d378451 commit db12853
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
12 changes: 0 additions & 12 deletions bitcoin/embedded/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ extern crate bitcoin;

use alloc::string::ToString;
use alloc::vec;
use core::alloc::Layout;
use core::panic::PanicInfo;

use alloc_cortex_m::CortexMHeap;
Expand All @@ -17,7 +16,6 @@ use bitcoin::{Address, Network, PrivateKey};
use bitcoin::secp256k1::ffi::types::AlignedType;
use bitcoin::secp256k1::Secp256k1;

use cortex_m::asm;
use cortex_m_rt::entry;
use cortex_m_semihosting::{debug, hprintln};

Expand Down Expand Up @@ -57,16 +55,6 @@ fn main() -> ! {
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)]
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
Expand Down
11 changes: 0 additions & 11 deletions hashes/embedded/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ extern crate bitcoin_hashes;

#[cfg(feature = "alloc")] extern crate alloc;
#[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;

use bitcoin_hashes::{sha256, Hash, HashEngine};
Expand Down Expand Up @@ -63,12 +61,3 @@ fn check_result(engine: sha256::HashEngine) {
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 {}
}

0 comments on commit db12853

Please sign in to comment.