Skip to content

Commit cacc082

Browse files
gurrycompiler-errors
authored andcommitted
Handle normalization failure in struct_tail_erasing_lifetimes
Fixes an ICE that occurred when the struct in question has an error
1 parent c3202af commit cacc082

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

compiler/rustc_middle/src/ty/layout.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,14 @@ impl<'tcx> SizeSkeleton<'tcx> {
338338
pointee,
339339
|ty| match tcx.try_normalize_erasing_regions(param_env, ty) {
340340
Ok(ty) => ty,
341-
Err(_e) => {
342-
if let Some(guar) = tcx.dcx().has_errors() {
343-
Ty::new_error(tcx, guar)
344-
} else {
345-
bug!("normalization failed, but no errors reported");
346-
}
347-
}
341+
Err(e) => Ty::new_error_with_message(
342+
tcx,
343+
DUMMY_SP,
344+
format!(
345+
"normalization failed for {} but no errors reported",
346+
e.get_type_for_failure()
347+
),
348+
),
348349
},
349350
|| {},
350351
);

0 commit comments

Comments
 (0)