diff options
| author | Amanieu d'Antras <amanieu@gmail.com> | 2022-01-12 20:45:31 +0000 |
|---|---|---|
| committer | Amanieu d'Antras <amanieu@gmail.com> | 2022-01-17 00:39:34 +0000 |
| commit | fe9dc6e62a312bc2fe01bb5ea65ea5d027ce878d (patch) | |
| tree | 945ace8c55bb41eb8ab713d06f0174b36d39d316 /compiler/rustc_monomorphize/src | |
| parent | 528c4f9158ead3df8cecb51663db50e711fec377 (diff) | |
| download | rust-fe9dc6e62a312bc2fe01bb5ea65ea5d027ce878d.tar.gz rust-fe9dc6e62a312bc2fe01bb5ea65ea5d027ce878d.zip | |
Change TerminatorKind::Abort to call the panic handler instead of
aborting immediately. The panic handler is called with a special flag which forces it to abort after calling the panic hook.
Diffstat (limited to 'compiler/rustc_monomorphize/src')
| -rw-r--r-- | compiler/rustc_monomorphize/src/collector.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 7e7f6938706..7f13da5d38f 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -807,10 +807,18 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { self.output.push(create_fn_mono_item(tcx, instance, source)); } } + mir::TerminatorKind::Abort { .. } => { + let instance = Instance::mono( + tcx, + tcx.require_lang_item(LangItem::PanicNoUnwind, 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::GeneratorDrop |
