use cherry-picked commit from #100754 to emit note without error
This commit is contained in:
@@ -364,9 +364,11 @@ passes_unknown_external_lang_item =
|
|||||||
passes_missing_panic_handler =
|
passes_missing_panic_handler =
|
||||||
`#[panic_handler]` function required, but not found
|
`#[panic_handler]` function required, but not found
|
||||||
|
|
||||||
passes_missing_alloc_error_handler =
|
passes_alloc_func_required =
|
||||||
`#[alloc_error_handler]` function required, but not found
|
`#[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 =
|
passes_missing_lang_item =
|
||||||
language item required, but not found: `{$name}`
|
language item required, but not found: `{$name}`
|
||||||
|
|||||||
@@ -690,9 +690,12 @@ pub struct UnknownExternLangItem {
|
|||||||
#[diag(passes::missing_panic_handler)]
|
#[diag(passes::missing_panic_handler)]
|
||||||
pub struct MissingPanicHandler;
|
pub struct MissingPanicHandler;
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
|
#[diag(passes::alloc_func_required)]
|
||||||
|
pub struct AllocFuncRequired;
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(passes::missing_alloc_error_handler)]
|
#[diag(passes::missing_alloc_error_handler)]
|
||||||
#[note]
|
|
||||||
pub struct MissingAllocErrorHandler;
|
pub struct MissingAllocErrorHandler;
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ use rustc_middle::ty::TyCtxt;
|
|||||||
use rustc_session::config::CrateType;
|
use rustc_session::config::CrateType;
|
||||||
|
|
||||||
use crate::errors::{
|
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
|
/// 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);
|
tcx.sess.emit_err(MissingPanicHandler);
|
||||||
} else if item == LangItem::Oom {
|
} else if item == LangItem::Oom {
|
||||||
if !tcx.features().default_alloc_error_handler {
|
if !tcx.features().default_alloc_error_handler {
|
||||||
tcx.sess.emit_err(MissingAllocErrorHandler);
|
tcx.sess.emit_err(AllocFuncRequired);
|
||||||
|
tcx.sess.emit_note(MissingAllocErrorHandler);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tcx.sess.emit_err(MissingLangItem { name: *name });
|
tcx.sess.emit_err(MissingLangItem { name: *name });
|
||||||
|
|||||||
Reference in New Issue
Block a user