refactor(rustc_middle): Substs -> GenericArg
This commit is contained in:
parent
df5c2cf9bc
commit
e55583c4b8
466 changed files with 4574 additions and 4604 deletions
|
@ -37,12 +37,12 @@ fn sized_constraint_for_ty<'tcx>(
|
|||
Some(&ty) => sized_constraint_for_ty(tcx, adtdef, ty),
|
||||
},
|
||||
|
||||
Adt(adt, substs) => {
|
||||
Adt(adt, args) => {
|
||||
// recursive case
|
||||
let adt_tys = adt.sized_constraint(tcx);
|
||||
debug!("sized_constraint_for_ty({:?}) intermediate = {:?}", ty, adt_tys);
|
||||
adt_tys
|
||||
.subst_iter_copied(tcx, substs)
|
||||
.arg_iter_copied(tcx, args)
|
||||
.flat_map(|ty| sized_constraint_for_ty(tcx, adtdef, ty))
|
||||
.collect()
|
||||
}
|
||||
|
@ -100,12 +100,10 @@ fn adt_sized_constraint(tcx: TyCtxt<'_>, def_id: DefId) -> &[Ty<'_>] {
|
|||
}
|
||||
let def = tcx.adt_def(def_id);
|
||||
|
||||
let result = tcx.mk_type_list_from_iter(
|
||||
def.variants()
|
||||
.iter()
|
||||
.filter_map(|v| v.tail_opt())
|
||||
.flat_map(|f| sized_constraint_for_ty(tcx, def, tcx.type_of(f.did).subst_identity())),
|
||||
);
|
||||
let result =
|
||||
tcx.mk_type_list_from_iter(def.variants().iter().filter_map(|v| v.tail_opt()).flat_map(
|
||||
|f| sized_constraint_for_ty(tcx, def, tcx.type_of(f.did).instantiate_identity()),
|
||||
));
|
||||
|
||||
debug!("adt_sized_constraint: {:?} => {:?}", def, result);
|
||||
|
||||
|
@ -133,7 +131,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
|
|||
if tcx.def_kind(def_id) == DefKind::AssocFn
|
||||
&& tcx.associated_item(def_id).container == ty::AssocItemContainer::TraitContainer
|
||||
{
|
||||
let sig = tcx.fn_sig(def_id).subst_identity();
|
||||
let sig = tcx.fn_sig(def_id).instantiate_identity();
|
||||
// We accounted for the binder of the fn sig, so skip the binder.
|
||||
sig.skip_binder().visit_with(&mut ImplTraitInTraitFinder {
|
||||
tcx,
|
||||
|
@ -282,7 +280,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitFinder<'_, 'tcx> {
|
|||
// If we're lowering to associated item, install the opaque type which is just
|
||||
// the `type_of` of the trait's associated item. If we're using the old lowering
|
||||
// strategy, then just reinterpret the associated type like an opaque :^)
|
||||
let default_ty = self.tcx.type_of(shifted_alias_ty.def_id).subst(self.tcx, shifted_alias_ty.substs);
|
||||
let default_ty = self.tcx.type_of(shifted_alias_ty.def_id).instantiate(self.tcx, shifted_alias_ty.args);
|
||||
|
||||
self.predicates.push(
|
||||
ty::Binder::bind_with_vars(
|
||||
|
@ -299,7 +297,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitFinder<'_, 'tcx> {
|
|||
for bound in self
|
||||
.tcx
|
||||
.item_bounds(unshifted_alias_ty.def_id)
|
||||
.subst_iter(self.tcx, unshifted_alias_ty.substs)
|
||||
.arg_iter(self.tcx, unshifted_alias_ty.args)
|
||||
{
|
||||
bound.visit_with(self);
|
||||
}
|
||||
|
@ -352,8 +350,8 @@ fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option<EarlyBinder<Ty<'
|
|||
}
|
||||
|
||||
// impl must be `impl Trait for dyn Marker1 + Marker2 + ...`
|
||||
if trait_ref.substs.len() != 1 {
|
||||
debug!("issue33140_self_ty - impl has substs!");
|
||||
if trait_ref.args.len() != 1 {
|
||||
debug!("issue33140_self_ty - impl has args!");
|
||||
return None;
|
||||
}
|
||||
|
||||
|
@ -409,7 +407,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.type_of(tail_field.did).subst_identity().walk() {
|
||||
for arg in tcx.type_of(tail_field.did).instantiate_identity().walk() {
|
||||
if let Some(i) = maybe_unsizing_param_idx(arg) {
|
||||
unsizing_params.insert(i);
|
||||
}
|
||||
|
@ -418,7 +416,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.type_of(field.did).subst_identity().walk() {
|
||||
for arg in tcx.type_of(field.did).instantiate_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