Increase the reach of panic_immediate_abort
This commit is contained in:
parent
7cc36de72d
commit
2e7364a586
9 changed files with 87 additions and 10 deletions
|
@ -377,13 +377,20 @@ pub const fn handle_alloc_error(layout: Layout) -> ! {
|
|||
panic!("allocation failed");
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn rt_error(layout: Layout) -> ! {
|
||||
unsafe {
|
||||
__rust_alloc_error_handler(layout.size(), layout.align());
|
||||
}
|
||||
}
|
||||
|
||||
unsafe { core::intrinsics::const_eval_select((layout,), ct_error, rt_error) }
|
||||
#[cfg(not(feature = "panic_immediate_abort"))]
|
||||
unsafe {
|
||||
core::intrinsics::const_eval_select((layout,), ct_error, rt_error)
|
||||
}
|
||||
|
||||
#[cfg(feature = "panic_immediate_abort")]
|
||||
ct_error(layout)
|
||||
}
|
||||
|
||||
// For alloc test `std::alloc::handle_alloc_error` can be used directly.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue