remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata
This commit is contained in:
parent
d822b97a27
commit
c183110cc2
164 changed files with 325 additions and 380 deletions
|
@ -28,7 +28,7 @@ fn assumed_wf_types(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::List<Ty<'_>> {
|
|||
tcx.intern_type_list(&types)
|
||||
}
|
||||
// Only the impl self type
|
||||
None => tcx.intern_type_list(&[tcx.bound_type_of(def_id).subst_identity()]),
|
||||
None => tcx.intern_type_list(&[tcx.type_of(def_id).subst_identity()]),
|
||||
}
|
||||
}
|
||||
DefKind::AssocConst | DefKind::AssocTy => tcx.assumed_wf_types(tcx.parent(def_id)),
|
||||
|
|
|
@ -52,7 +52,7 @@ fn inner_resolve_instance<'tcx>(
|
|||
tcx.normalize_erasing_regions(param_env, substs),
|
||||
)
|
||||
} else {
|
||||
let ty = tcx.bound_type_of(def.def_id_for_type_of());
|
||||
let ty = tcx.type_of(def.def_id_for_type_of());
|
||||
let item_type =
|
||||
tcx.subst_and_normalize_erasing_regions(substs, param_env, ty.skip_binder());
|
||||
|
||||
|
|
|
@ -454,7 +454,7 @@ fn layout_of_uncached<'tcx>(
|
|||
def.is_struct()
|
||||
&& match def.variants().iter().next().and_then(|x| x.fields.last()) {
|
||||
Some(last_field) => tcx
|
||||
.bound_type_of(last_field.did)
|
||||
.type_of(last_field.did)
|
||||
.subst_identity()
|
||||
.is_sized(tcx, param_env),
|
||||
None => false,
|
||||
|
|
|
@ -242,7 +242,7 @@ fn drop_tys_helper<'tcx>(
|
|||
Ok(Vec::new())
|
||||
} else {
|
||||
let field_tys = adt_def.all_fields().map(|field| {
|
||||
let r = tcx.bound_type_of(field.did).subst(tcx, substs);
|
||||
let r = tcx.type_of(field.did).subst(tcx, substs);
|
||||
debug!("drop_tys_helper: Subst into {:?} with {:?} gettng {:?}", field, substs, r);
|
||||
r
|
||||
});
|
||||
|
@ -297,7 +297,7 @@ fn adt_drop_tys<'tcx>(
|
|||
// `tcx.type_of(def_id)` identical to `tcx.make_adt(def, identity_substs)`
|
||||
drop_tys_helper(
|
||||
tcx,
|
||||
tcx.bound_type_of(def_id).subst_identity(),
|
||||
tcx.type_of(def_id).subst_identity(),
|
||||
tcx.param_env(def_id),
|
||||
adt_has_dtor,
|
||||
false,
|
||||
|
@ -314,7 +314,7 @@ fn adt_significant_drop_tys(
|
|||
) -> Result<&ty::List<Ty<'_>>, AlwaysRequiresDrop> {
|
||||
drop_tys_helper(
|
||||
tcx,
|
||||
tcx.bound_type_of(def_id).subst_identity(), // identical to `tcx.make_adt(def, identity_substs)`
|
||||
tcx.type_of(def_id).subst_identity(), // identical to `tcx.make_adt(def, identity_substs)`
|
||||
tcx.param_env(def_id),
|
||||
adt_consider_insignificant_dtor(tcx),
|
||||
true,
|
||||
|
|
|
@ -31,7 +31,7 @@ fn representability(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Representability {
|
|||
}
|
||||
Representability::Representable
|
||||
}
|
||||
DefKind::Field => representability_ty(tcx, tcx.bound_type_of(def_id).subst_identity()),
|
||||
DefKind::Field => representability_ty(tcx, tcx.type_of(def_id).subst_identity()),
|
||||
def_kind => bug!("unexpected {def_kind:?}"),
|
||||
}
|
||||
}
|
||||
|
@ -91,11 +91,7 @@ fn params_in_repr(tcx: TyCtxt<'_>, def_id: DefId) -> BitSet<u32> {
|
|||
let mut params_in_repr = BitSet::new_empty(generics.params.len());
|
||||
for variant in adt_def.variants() {
|
||||
for field in variant.fields.iter() {
|
||||
params_in_repr_ty(
|
||||
tcx,
|
||||
tcx.bound_type_of(field.did).subst_identity(),
|
||||
&mut params_in_repr,
|
||||
);
|
||||
params_in_repr_ty(tcx, tcx.type_of(field.did).subst_identity(), &mut params_in_repr);
|
||||
}
|
||||
}
|
||||
params_in_repr
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue