Check representability in adt_sized_constraint

This commit is contained in:
Cameron Steffen 2022-10-10 11:22:41 -05:00
parent 0265a3e93b
commit d933092dc5
15 changed files with 50 additions and 91 deletions

View file

@ -380,7 +380,6 @@ fn check_struct(tcx: TyCtxt<'_>, def_id: LocalDefId) {
let def = tcx.adt_def(def_id);
let span = tcx.def_span(def_id);
def.destructor(tcx); // force the destructor to be evaluated
let _ = tcx.representability(def_id);
if def.repr().simd() {
check_simd(tcx, span, def_id);
@ -394,7 +393,6 @@ fn check_union(tcx: TyCtxt<'_>, def_id: LocalDefId) {
let def = tcx.adt_def(def_id);
let span = tcx.def_span(def_id);
def.destructor(tcx); // force the destructor to be evaluated
let _ = tcx.representability(def_id);
check_transparent(tcx, span, def);
check_union_fields(tcx, span, def_id);
check_packed(tcx, span, def);
@ -1487,7 +1485,6 @@ fn check_enum<'tcx>(tcx: TyCtxt<'tcx>, vs: &'tcx [hir::Variant<'tcx>], def_id: L
detect_discriminant_duplicate(tcx, def.discriminants(tcx).collect(), vs, sp);
let _ = tcx.representability(def_id);
check_transparent(tcx, sp, def);
}

View file

@ -1041,6 +1041,8 @@ fn check_type_defn<'tcx, F>(
) where
F: FnMut(&WfCheckingCtxt<'_, 'tcx>) -> Vec<AdtVariant<'tcx>>,
{
let _ = tcx.representability(item.def_id.def_id);
enter_wf_checking_ctxt(tcx, item.span, item.def_id.def_id, |wfcx| {
let variants = lookup_fields(wfcx);
let packed = tcx.adt_def(item.def_id).repr().packed();