Skip to content

Commit

Permalink
Remove #[alloc_error_handler], fix nightly build
Browse files Browse the repository at this point in the history
  • Loading branch information
equation314 committed Apr 24, 2023
1 parent e1666c7 commit 84f5848
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//! be registered as the standard library’s default allocator.
#![no_std]
#![feature(alloc_error_handler)]

#[macro_use]
extern crate log;
Expand Down Expand Up @@ -168,16 +167,6 @@ unsafe impl GlobalAlloc for GlobalAllocator {
#[cfg_attr(all(target_os = "none", not(test)), global_allocator)]
static GLOBAL_ALLOCATOR: GlobalAllocator = GlobalAllocator::new();

#[cfg(all(target_os = "none", not(test)))]
#[alloc_error_handler]
fn handle_alloc_error(layout: Layout) -> ! {
panic!(
"Heap allocation error: available_bytes = {}, request = {:?}",
global_allocator().available_bytes(),
layout
);
}

/// Returns the reference to the global allocator.
pub fn global_allocator() -> &'static GlobalAllocator {
&GLOBAL_ALLOCATOR
Expand Down

0 comments on commit 84f5848

Please sign in to comment.