Rollup merge of #114450 - chenyukang:yukang-fix-114435, r=compiler-errors

Fix ICE failed to get layout for ReferencesError

Fixes #114435

r? `@compiler-errors`
This commit is contained in:
Matthias Krüger 2023-08-04 21:31:57 +02:00 committed by GitHub
commit a0fd747e38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 3 deletions

View file

@ -985,7 +985,7 @@ impl<'tcx> LayoutOfHelpers<'tcx> for CodegenCx<'_, 'tcx> {
#[inline]
fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! {
if let LayoutError::SizeOverflow(_) = err {
if let LayoutError::SizeOverflow(_) | LayoutError::ReferencesError(_) = err {
self.sess().emit_fatal(Spanned { span, node: err.into_diagnostic() })
} else {
span_bug!(span, "failed to get layout for `{ty}`: {err:?}")