remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata

This commit is contained in:
Kyle Matsuda
2023-02-07 01:29:48 -07:00
parent d822b97a27
commit c183110cc2
164 changed files with 325 additions and 380 deletions

View File

@@ -99,10 +99,12 @@ fn adt_sized_constraint(tcx: TyCtxt<'_>, def_id: DefId) -> &[Ty<'_>] {
}
let def = tcx.adt_def(def_id);
let result =
tcx.mk_type_list(def.variants().iter().flat_map(|v| v.fields.last()).flat_map(|f| {
sized_constraint_for_ty(tcx, def, tcx.bound_type_of(f.did).subst_identity())
}));
let result = tcx.mk_type_list(
def.variants()
.iter()
.flat_map(|v| v.fields.last())
.flat_map(|f| sized_constraint_for_ty(tcx, def, tcx.type_of(f.did).subst_identity())),
);
debug!("adt_sized_constraint: {:?} => {:?}", def, result);
@@ -297,7 +299,7 @@ fn well_formed_types_in_env(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::List<Predica
// In an inherent impl, we assume that the receiver type and all its
// constituents are well-formed.
NodeKind::InherentImpl => {
let self_ty = tcx.bound_type_of(def_id).subst_identity();
let self_ty = tcx.type_of(def_id).subst_identity();
inputs.extend(self_ty.walk());
}
@@ -432,7 +434,7 @@ fn unsizing_params_for_adt<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> BitSet<u32
};
let mut unsizing_params = BitSet::new_empty(num_params);
for arg in tcx.bound_type_of(tail_field.did).subst_identity().walk() {
for arg in tcx.type_of(tail_field.did).subst_identity().walk() {
if let Some(i) = maybe_unsizing_param_idx(arg) {
unsizing_params.insert(i);
}
@@ -441,7 +443,7 @@ fn unsizing_params_for_adt<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> BitSet<u32
// Ensure none of the other fields mention the parameters used
// in unsizing.
for field in prefix_fields {
for arg in tcx.bound_type_of(field.did).subst_identity().walk() {
for arg in tcx.type_of(field.did).subst_identity().walk() {
if let Some(i) = maybe_unsizing_param_idx(arg) {
unsizing_params.remove(i);
}