make (try_)subst_and_normalize_erasing_regions take EarlyBinder

This commit is contained in:
Kyle Matsuda 2023-02-20 12:46:39 -07:00
parent 34bee196cb
commit e5d10cdbc3
8 changed files with 14 additions and 15 deletions

View File

@ -93,7 +93,7 @@ fn make_mir_scope<'ll, 'tcx>(
let callee = cx.tcx.subst_and_normalize_erasing_regions(
instance.substs,
ty::ParamEnv::reveal_all(),
callee,
ty::EarlyBinder(callee),
);
let callee_fn_abi = cx.fn_abi_of_instance(callee, ty::List::empty());
cx.dbg_scope_fn(callee, callee_fn_abi, None)

View File

@ -529,7 +529,7 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
let impl_self_ty = cx.tcx.subst_and_normalize_erasing_regions(
instance.substs,
ty::ParamEnv::reveal_all(),
cx.tcx.type_of(impl_def_id).skip_binder(),
cx.tcx.type_of(impl_def_id),
);
// Only "class" methods are generally understood by LLVM,

View File

@ -115,7 +115,7 @@ impl<'tcx> Instance<'tcx> {
/// lifetimes erased, allowing a `ParamEnv` to be specified for use during normalization.
pub fn ty(&self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> Ty<'tcx> {
let ty = tcx.type_of(self.def.def_id());
tcx.subst_and_normalize_erasing_regions(self.substs, param_env, ty.skip_binder())
tcx.subst_and_normalize_erasing_regions(self.substs, param_env, ty)
}
/// Finds a crate that contains a monomorphization of this instance that
@ -600,7 +600,7 @@ impl<'tcx> Instance<'tcx> {
T: TypeFoldable<TyCtxt<'tcx>> + Clone,
{
if let Some(substs) = self.substs_for_mir_body() {
tcx.subst_and_normalize_erasing_regions(substs, param_env, v)
tcx.subst_and_normalize_erasing_regions(substs, param_env, ty::EarlyBinder(v))
} else {
tcx.normalize_erasing_regions(param_env, v)
}
@ -617,7 +617,7 @@ impl<'tcx> Instance<'tcx> {
T: TypeFoldable<TyCtxt<'tcx>> + Clone,
{
if let Some(substs) = self.substs_for_mir_body() {
tcx.try_subst_and_normalize_erasing_regions(substs, param_env, v)
tcx.try_subst_and_normalize_erasing_regions(substs, param_env, ty::EarlyBinder(v))
} else {
tcx.try_normalize_erasing_regions(param_env, v)
}

View File

@ -139,7 +139,7 @@ impl<'tcx> TyCtxt<'tcx> {
self,
param_substs: SubstsRef<'tcx>,
param_env: ty::ParamEnv<'tcx>,
value: T,
value: EarlyBinder<T>,
) -> T
where
T: TypeFoldable<TyCtxt<'tcx>>,
@ -151,7 +151,7 @@ impl<'tcx> TyCtxt<'tcx> {
param_env={:?})",
param_substs, value, param_env,
);
let substituted = EarlyBinder(value).subst(self, param_substs);
let substituted = value.subst(self, param_substs);
self.normalize_erasing_regions(param_env, substituted)
}
@ -163,7 +163,7 @@ impl<'tcx> TyCtxt<'tcx> {
self,
param_substs: SubstsRef<'tcx>,
param_env: ty::ParamEnv<'tcx>,
value: T,
value: EarlyBinder<T>,
) -> Result<T, NormalizationError<'tcx>>
where
T: TypeFoldable<TyCtxt<'tcx>>,
@ -175,7 +175,7 @@ impl<'tcx> TyCtxt<'tcx> {
param_env={:?})",
param_substs, value, param_env,
);
let substituted = EarlyBinder(value).subst(self, param_substs);
let substituted = value.subst(self, param_substs);
self.try_normalize_erasing_regions(param_env, substituted)
}
}

View File

@ -310,7 +310,7 @@ fn characteristic_def_id_of_mono_item<'tcx>(
let impl_self_ty = tcx.subst_and_normalize_erasing_regions(
instance.substs,
ty::ParamEnv::reveal_all(),
tcx.type_of(impl_def_id).skip_binder(),
tcx.type_of(impl_def_id),
);
if let Some(def_id) = characteristic_def_id_of_type(impl_self_ty) {
return Some(def_id);

View File

@ -29,12 +29,12 @@ pub(crate) fn dump_closure_profile<'tcx>(tcx: TyCtxt<'tcx>, closure_instance: In
let before_feature_tys = tcx.subst_and_normalize_erasing_regions(
closure_instance.substs,
param_env,
before_feature_tys,
ty::EarlyBinder(before_feature_tys),
);
let after_feature_tys = tcx.subst_and_normalize_erasing_regions(
closure_instance.substs,
param_env,
after_feature_tys,
ty::EarlyBinder(after_feature_tys),
);
let new_size = tcx

View File

@ -27,8 +27,7 @@ fn resolve_instance<'tcx>(
)
} else {
let ty = tcx.type_of(def);
let item_type =
tcx.subst_and_normalize_erasing_regions(substs, param_env, ty.skip_binder());
let item_type = tcx.subst_and_normalize_erasing_regions(substs, param_env, ty);
let def = match *item_type.kind() {
ty::FnDef(def_id, ..) if tcx.is_intrinsic(def_id) => {

View File

@ -435,7 +435,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
let output_ty = fn_sig.output();
if output_ty.contains(*param_ty) {
if let Ok(new_ty) = cx.tcx.try_subst_and_normalize_erasing_regions(
new_subst, cx.param_env, output_ty) {
new_subst, cx.param_env, EarlyBinder(output_ty)) {
expr = parent_expr;
ty = new_ty;
continue;