remove has_error_field helper method

This commit is contained in:
lcnr 2023-06-06 09:37:30 +02:00
parent fd9bf59436
commit 01aaad3f1f
5 changed files with 9 additions and 40 deletions

View file

@ -1745,9 +1745,11 @@ fn check_variances_for_type_defn<'tcx>(
item: &hir::Item<'tcx>,
hir_generics: &hir::Generics<'_>,
) {
let ty = tcx.type_of(item.owner_id).subst_identity();
if tcx.has_error_field(ty) {
return;
let identity_substs = ty::InternalSubsts::identity_for_item(tcx, item.owner_id);
for field in tcx.adt_def(item.owner_id).all_fields() {
if field.ty(tcx, identity_substs).references_error() {
return;
}
}
let ty_predicates = tcx.predicates_of(item.owner_id);