1
Fork 0

Rollup merge of #84262 - camelid:sized-ice, r=estebank

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

Fixes #84108.

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.

r? `@estebank`

[comment]: https://github.com/rust-lang/rust/issues/84108#issuecomment-818916848
This commit is contained in:
Yuki Okushi 2021-06-07 15:20:56 +09:00 committed by GitHub
commit ac6e239b3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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() {