Skip to content

Commit e5d10cd

Browse files
committed
make (try_)subst_and_normalize_erasing_regions take EarlyBinder
1 parent 34bee19 commit e5d10cd

File tree

8 files changed

+14
-15
lines changed

8 files changed

+14
-15
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ fn make_mir_scope<'ll, 'tcx>(
9393
let callee = cx.tcx.subst_and_normalize_erasing_regions(
9494
instance.substs,
9595
ty::ParamEnv::reveal_all(),
96-
callee,
96+
ty::EarlyBinder(callee),
9797
);
9898
let callee_fn_abi = cx.fn_abi_of_instance(callee, ty::List::empty());
9999
cx.dbg_scope_fn(callee, callee_fn_abi, None)

compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
529529
let impl_self_ty = cx.tcx.subst_and_normalize_erasing_regions(
530530
instance.substs,
531531
ty::ParamEnv::reveal_all(),
532-
cx.tcx.type_of(impl_def_id).skip_binder(),
532+
cx.tcx.type_of(impl_def_id),
533533
);
534534

535535
// Only "class" methods are generally understood by LLVM,

compiler/rustc_middle/src/ty/instance.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl<'tcx> Instance<'tcx> {
115115
/// lifetimes erased, allowing a `ParamEnv` to be specified for use during normalization.
116116
pub fn ty(&self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> Ty<'tcx> {
117117
let ty = tcx.type_of(self.def.def_id());
118-
tcx.subst_and_normalize_erasing_regions(self.substs, param_env, ty.skip_binder())
118+
tcx.subst_and_normalize_erasing_regions(self.substs, param_env, ty)
119119
}
120120

121121
/// Finds a crate that contains a monomorphization of this instance that
@@ -600,7 +600,7 @@ impl<'tcx> Instance<'tcx> {
600600
T: TypeFoldable<TyCtxt<'tcx>> + Clone,
601601
{
602602
if let Some(substs) = self.substs_for_mir_body() {
603-
tcx.subst_and_normalize_erasing_regions(substs, param_env, v)
603+
tcx.subst_and_normalize_erasing_regions(substs, param_env, ty::EarlyBinder(v))
604604
} else {
605605
tcx.normalize_erasing_regions(param_env, v)
606606
}
@@ -617,7 +617,7 @@ impl<'tcx> Instance<'tcx> {
617617
T: TypeFoldable<TyCtxt<'tcx>> + Clone,
618618
{
619619
if let Some(substs) = self.substs_for_mir_body() {
620-
tcx.try_subst_and_normalize_erasing_regions(substs, param_env, v)
620+
tcx.try_subst_and_normalize_erasing_regions(substs, param_env, ty::EarlyBinder(v))
621621
} else {
622622
tcx.try_normalize_erasing_regions(param_env, v)
623623
}

compiler/rustc_middle/src/ty/normalize_erasing_regions.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<'tcx> TyCtxt<'tcx> {
139139
self,
140140
param_substs: SubstsRef<'tcx>,
141141
param_env: ty::ParamEnv<'tcx>,
142-
value: T,
142+
value: EarlyBinder<T>,
143143
) -> T
144144
where
145145
T: TypeFoldable<TyCtxt<'tcx>>,
@@ -151,7 +151,7 @@ impl<'tcx> TyCtxt<'tcx> {
151151
param_env={:?})",
152152
param_substs, value, param_env,
153153
);
154-
let substituted = EarlyBinder(value).subst(self, param_substs);
154+
let substituted = value.subst(self, param_substs);
155155
self.normalize_erasing_regions(param_env, substituted)
156156
}
157157

@@ -163,7 +163,7 @@ impl<'tcx> TyCtxt<'tcx> {
163163
self,
164164
param_substs: SubstsRef<'tcx>,
165165
param_env: ty::ParamEnv<'tcx>,
166-
value: T,
166+
value: EarlyBinder<T>,
167167
) -> Result<T, NormalizationError<'tcx>>
168168
where
169169
T: TypeFoldable<TyCtxt<'tcx>>,
@@ -175,7 +175,7 @@ impl<'tcx> TyCtxt<'tcx> {
175175
param_env={:?})",
176176
param_substs, value, param_env,
177177
);
178-
let substituted = EarlyBinder(value).subst(self, param_substs);
178+
let substituted = value.subst(self, param_substs);
179179
self.try_normalize_erasing_regions(param_env, substituted)
180180
}
181181
}

compiler/rustc_monomorphize/src/partitioning/default.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ fn characteristic_def_id_of_mono_item<'tcx>(
310310
let impl_self_ty = tcx.subst_and_normalize_erasing_regions(
311311
instance.substs,
312312
ty::ParamEnv::reveal_all(),
313-
tcx.type_of(impl_def_id).skip_binder(),
313+
tcx.type_of(impl_def_id),
314314
);
315315
if let Some(def_id) = characteristic_def_id_of_type(impl_self_ty) {
316316
return Some(def_id);

compiler/rustc_monomorphize/src/util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ pub(crate) fn dump_closure_profile<'tcx>(tcx: TyCtxt<'tcx>, closure_instance: In
2929
let before_feature_tys = tcx.subst_and_normalize_erasing_regions(
3030
closure_instance.substs,
3131
param_env,
32-
before_feature_tys,
32+
ty::EarlyBinder(before_feature_tys),
3333
);
3434
let after_feature_tys = tcx.subst_and_normalize_erasing_regions(
3535
closure_instance.substs,
3636
param_env,
37-
after_feature_tys,
37+
ty::EarlyBinder(after_feature_tys),
3838
);
3939

4040
let new_size = tcx

compiler/rustc_ty_utils/src/instance.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ fn resolve_instance<'tcx>(
2727
)
2828
} else {
2929
let ty = tcx.type_of(def);
30-
let item_type =
31-
tcx.subst_and_normalize_erasing_regions(substs, param_env, ty.skip_binder());
30+
let item_type = tcx.subst_and_normalize_erasing_regions(substs, param_env, ty);
3231

3332
let def = match *item_type.kind() {
3433
ty::FnDef(def_id, ..) if tcx.is_intrinsic(def_id) => {

src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
435435
let output_ty = fn_sig.output();
436436
if output_ty.contains(*param_ty) {
437437
if let Ok(new_ty) = cx.tcx.try_subst_and_normalize_erasing_regions(
438-
new_subst, cx.param_env, output_ty) {
438+
new_subst, cx.param_env, EarlyBinder(output_ty)) {
439439
expr = parent_expr;
440440
ty = new_ty;
441441
continue;

0 commit comments

Comments
 (0)