1
Fork 0

Fix ICE during type layout when there's a [type error]

Based on estebank's [comment], except I used `delay_span_bug` because it
should work in more cases, and I think it expresses its intent more
clearly.

[comment]: https://github.com/rust-lang/rust/issues/84108#issuecomment-818916848
This commit is contained in:
Camelid 2021-04-13 19:18:23 -07:00
parent 132b4e5d16
commit c30eac51c4
3 changed files with 66 additions and 1 deletions

View file

@ -367,7 +367,14 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
for &i in &inverse_memory_index {
let field = fields[i as usize];
if !sized {
bug!("univariant: field #{} of `{}` comes after unsized field", offsets.len(), ty);
self.tcx.sess.delay_span_bug(
DUMMY_SP,
&format!(
"univariant: field #{} of `{}` comes after unsized field",
offsets.len(),
ty
),
);
}
if field.is_unsized() {