Auto merge of #76448 - haraldh:default_alloc_error_handler_reduced, r=Amanieu
Implement Make `handle_alloc_error` default to panic (for no_std + liballoc) Related: https://github.com/rust-lang/rust/issues/66741 Guarded with `#![feature(default_alloc_error_handler)]` a default `alloc_error_handler` is called, if a custom allocator is used and no other custom `#[alloc_error_handler]` is defined.
This commit is contained in:
commit
0d37dca25a
12 changed files with 292 additions and 7 deletions
|
@ -64,7 +64,10 @@ fn verify<'tcx>(tcx: TyCtxt<'tcx>, items: &lang_items::LanguageItems) {
|
|||
if item == LangItem::PanicImpl {
|
||||
tcx.sess.err("`#[panic_handler]` function required, but not found");
|
||||
} else if item == LangItem::Oom {
|
||||
tcx.sess.err("`#[alloc_error_handler]` function required, but not found");
|
||||
if !tcx.features().default_alloc_error_handler {
|
||||
tcx.sess.err("`#[alloc_error_handler]` function required, but not found.");
|
||||
tcx.sess.note_without_error("Use `#![feature(default_alloc_error_handler)]` for a default error handler.");
|
||||
}
|
||||
} else {
|
||||
tcx.sess.err(&format!("language item required, but not found: `{}`", name));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue