Rollup merge of #124909 - compiler-errors:struct-tail-leftovers, r=compiler-errors

Reapply the part of #124548 that bors forgot

https://github.com/rust-lang/rust/pull/124548#issuecomment-2101311205
r? compiler-errors
This commit is contained in:
Matthias Krüger
2024-05-08 23:33:28 +02:00
committed by GitHub

View File

@@ -338,13 +338,14 @@ impl<'tcx> SizeSkeleton<'tcx> {
pointee, pointee,
|ty| match tcx.try_normalize_erasing_regions(param_env, ty) { |ty| match tcx.try_normalize_erasing_regions(param_env, ty) {
Ok(ty) => ty, Ok(ty) => ty,
Err(_e) => { Err(e) => Ty::new_error_with_message(
if let Some(guar) = tcx.dcx().has_errors() { tcx,
Ty::new_error(tcx, guar) DUMMY_SP,
} else { format!(
bug!("normalization failed, but no errors reported"); "normalization failed for {} but no errors reported",
} e.get_type_for_failure()
} ),
),
}, },
|| {}, || {},
); );