Auto merge of #90406 - nbdd0121:panic, r=cjgillot
Collect `panic/panic_bounds_check` during monomorphization This would prevent link time errors if these functions are `#[inline]` (e.g. when `panic_immediate_abort` is used). Fix #90405 Fix rust-lang/cargo#10019 `@rustbot` label: T-compiler A-codegen
This commit is contained in:
commit
db062de72b
3 changed files with 71 additions and 4 deletions
|
@ -806,13 +806,22 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
}
|
||||
mir::TerminatorKind::Assert { ref msg, .. } => {
|
||||
let lang_item = match msg {
|
||||
mir::AssertKind::BoundsCheck { .. } => LangItem::PanicBoundsCheck,
|
||||
_ => LangItem::Panic,
|
||||
};
|
||||
let instance = Instance::mono(tcx, tcx.require_lang_item(lang_item, Some(source)));
|
||||
if should_codegen_locally(tcx, &instance) {
|
||||
self.output.push(create_fn_mono_item(tcx, instance, source));
|
||||
}
|
||||
}
|
||||
mir::TerminatorKind::Goto { .. }
|
||||
| mir::TerminatorKind::SwitchInt { .. }
|
||||
| mir::TerminatorKind::Resume
|
||||
| mir::TerminatorKind::Abort
|
||||
| mir::TerminatorKind::Return
|
||||
| mir::TerminatorKind::Unreachable
|
||||
| mir::TerminatorKind::Assert { .. } => {}
|
||||
| mir::TerminatorKind::Unreachable => {}
|
||||
mir::TerminatorKind::GeneratorDrop
|
||||
| mir::TerminatorKind::Yield { .. }
|
||||
| mir::TerminatorKind::FalseEdge { .. }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue