diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-10-09 20:27:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-09 20:27:24 +0200 |
| commit | f144469bda886b14a8bfcb93233a894a76f450cf (patch) | |
| tree | 81eeae036e2498cb36bf99df9d67295a17d91cd6 /compiler/rustc_codegen_llvm/src | |
| parent | b76667aed2533423544813a5b6b0253f2138788c (diff) | |
| parent | 17eca60c2432d4b140ec0dca441cc6fde6562698 (diff) | |
| download | rust-f144469bda886b14a8bfcb93233a894a76f450cf.tar.gz rust-f144469bda886b14a8bfcb93233a894a76f450cf.zip | |
Rollup merge of #131420 - compiler-errors:post-mono-layout-cycle, r=wesleywiser
Dont ICE when encountering post-mono layout cycle error It's possible to encounter post-mono layout cycle errors in `fn_abi_of_instance`. Don't ICE in those cases. This was originally discovered in an async fn, but that's not the only way to encounter such an error (which the other test I added should demonstrate). Error messsages suck, but this fix is purely about suppressing the ICE. Fixes #131409
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/context.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 81b82840472..0a116971e07 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -1187,10 +1187,11 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for CodegenCx<'_, 'tcx> { span: Span, fn_abi_request: FnAbiRequest<'tcx>, ) -> ! { - if let FnAbiError::Layout(LayoutError::SizeOverflow(_)) = err { - self.tcx.dcx().emit_fatal(Spanned { span, node: err }) - } else { - match fn_abi_request { + match err { + FnAbiError::Layout(LayoutError::SizeOverflow(_) | LayoutError::Cycle(_)) => { + self.tcx.dcx().emit_fatal(Spanned { span, node: err }); + } + _ => match fn_abi_request { FnAbiRequest::OfFnPtr { sig, extra_args } => { span_bug!(span, "`fn_abi_of_fn_ptr({sig}, {extra_args:?})` failed: {err:?}",); } @@ -1200,7 +1201,7 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for CodegenCx<'_, 'tcx> { "`fn_abi_of_instance({instance}, {extra_args:?})` failed: {err:?}", ); } - } + }, } } } |
