Skip to content
Permalink
Browse files

Avoid ICE during `repr(packed)` well-formedness check via delay_span_…

…bug.

(It is possible that there is a more fundamental invariant being
violated, in terms of the `check_type_defn` code assuming that lifting
to tcx will always succeed. But I am unaware of any test input that
hits this that isn't already type-incorrect in some fashion.)
  • Loading branch information...
pnkfelix committed Mar 6, 2019
1 parent a9da8fc commit d2482fd36ac144b5dac106026b90d112d4707d79
Showing with 7 additions and 4 deletions.
  1. +7 −4 src/librustc_typeck/check/wfcheck.rs
@@ -250,11 +250,14 @@ fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
let needs_drop_copy = || {
packed && {
let ty = variant.fields.last().unwrap().ty;
let ty = fcx.tcx.erase_regions(&ty).lift_to_tcx(fcx_tcx)
fcx.tcx.erase_regions(&ty).lift_to_tcx(fcx_tcx)
.map(|ty| ty.needs_drop(fcx_tcx, fcx_tcx.param_env(def_id)))
.unwrap_or_else(|| {
span_bug!(item.span, "inference variables in {:?}", ty)
});
ty.needs_drop(fcx_tcx, fcx_tcx.param_env(def_id))
fcx_tcx.sess.delay_span_bug(
item.span, &format!("inference variables in {:?}", ty));
// Just treat unresolved type expression as if it needs drop.
true
})
}
};
let all_sized =

0 comments on commit d2482fd

Please sign in to comment.
You can’t perform that action at this time.