mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
use cherry-picked commit from #100754 to emit note without error
This commit is contained in:
parent
f8ebc72b4a
commit
3a748330af
@ -364,9 +364,11 @@ passes_unknown_external_lang_item =
|
||||
passes_missing_panic_handler =
|
||||
`#[panic_handler]` function required, but not found
|
||||
|
||||
passes_missing_alloc_error_handler =
|
||||
passes_alloc_func_required =
|
||||
`#[alloc_error_handler]` function required, but not found
|
||||
.note = use `#![feature(default_alloc_error_handler)]` for a default error handler
|
||||
|
||||
passes_missing_alloc_error_handler =
|
||||
use `#![feature(default_alloc_error_handler)]` for a default error handler
|
||||
|
||||
passes_missing_lang_item =
|
||||
language item required, but not found: `{$name}`
|
||||
|
@ -690,9 +690,12 @@ pub struct UnknownExternLangItem {
|
||||
#[diag(passes::missing_panic_handler)]
|
||||
pub struct MissingPanicHandler;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes::alloc_func_required)]
|
||||
pub struct AllocFuncRequired;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes::missing_alloc_error_handler)]
|
||||
#[note]
|
||||
pub struct MissingAllocErrorHandler;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
|
@ -8,7 +8,8 @@ use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::config::CrateType;
|
||||
|
||||
use crate::errors::{
|
||||
MissingAllocErrorHandler, MissingLangItem, MissingPanicHandler, UnknownExternLangItem,
|
||||
AllocFuncRequired, MissingAllocErrorHandler, MissingLangItem, MissingPanicHandler,
|
||||
UnknownExternLangItem,
|
||||
};
|
||||
|
||||
/// Checks the crate for usage of weak lang items, returning a vector of all the
|
||||
@ -70,7 +71,8 @@ fn verify<'tcx>(tcx: TyCtxt<'tcx>, items: &lang_items::LanguageItems) {
|
||||
tcx.sess.emit_err(MissingPanicHandler);
|
||||
} else if item == LangItem::Oom {
|
||||
if !tcx.features().default_alloc_error_handler {
|
||||
tcx.sess.emit_err(MissingAllocErrorHandler);
|
||||
tcx.sess.emit_err(AllocFuncRequired);
|
||||
tcx.sess.emit_note(MissingAllocErrorHandler);
|
||||
}
|
||||
} else {
|
||||
tcx.sess.emit_err(MissingLangItem { name: *name });
|
||||
|
Loading…
Reference in New Issue
Block a user