Rollup merge of #115353 - Enselic:no-optimized-mir, r=oli-obk
Emit error instead of ICE when optimized MIR is missing Closes #51388
This commit is contained in:
commit
a73c663ec4
6 changed files with 44 additions and 3 deletions
|
@ -192,7 +192,8 @@ use rustc_target::abi::Size;
|
|||
use std::path::PathBuf;
|
||||
|
||||
use crate::errors::{
|
||||
EncounteredErrorWhileInstantiating, LargeAssignmentsLint, RecursionLimit, TypeLengthLimit,
|
||||
EncounteredErrorWhileInstantiating, LargeAssignmentsLint, NoOptimizedMir, RecursionLimit,
|
||||
TypeLengthLimit,
|
||||
};
|
||||
|
||||
#[derive(PartialEq)]
|
||||
|
@ -960,7 +961,10 @@ fn should_codegen_locally<'tcx>(tcx: TyCtxt<'tcx>, instance: &Instance<'tcx>) ->
|
|||
}
|
||||
|
||||
if !tcx.is_mir_available(def_id) {
|
||||
bug!("no MIR available for {:?}", def_id);
|
||||
tcx.sess.emit_fatal(NoOptimizedMir {
|
||||
span: tcx.def_span(def_id),
|
||||
crate_name: tcx.crate_name(def_id.krate),
|
||||
});
|
||||
}
|
||||
|
||||
true
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::fluent_generated as fluent;
|
|||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_errors::IntoDiagnostic;
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(monomorphize_recursion_limit)]
|
||||
|
@ -33,6 +33,14 @@ pub struct TypeLengthLimit {
|
|||
pub type_length: usize,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(monomorphize_no_optimized_mir)]
|
||||
pub struct NoOptimizedMir {
|
||||
#[note]
|
||||
pub span: Span,
|
||||
pub crate_name: Symbol,
|
||||
}
|
||||
|
||||
pub struct UnusedGenericParamsHint {
|
||||
pub span: Span,
|
||||
pub param_spans: Vec<Span>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue