Skip to content

Commit 82f57c1

Browse files
committed
use EarlyBinder in tcx.(try_)subst_mir_and_normalize_erasing_regions
1 parent e5d10cd commit 82f57c1

File tree

7 files changed

+20
-12
lines changed

7 files changed

+20
-12
lines changed

compiler/rustc_codegen_cranelift/src/common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
361361
self.instance.subst_mir_and_normalize_erasing_regions(
362362
self.tcx,
363363
ty::ParamEnv::reveal_all(),
364-
value,
364+
ty::EarlyBinder(value),
365365
)
366366
}
367367

compiler/rustc_codegen_ssa/src/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
111111
self.instance.subst_mir_and_normalize_erasing_regions(
112112
self.cx.tcx(),
113113
ty::ParamEnv::reveal_all(),
114-
value,
114+
ty::EarlyBinder(value),
115115
)
116116
}
117117
}

compiler/rustc_const_eval/src/interpret/eval_context.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
495495
) -> Result<T, InterpError<'tcx>> {
496496
frame
497497
.instance
498-
.try_subst_mir_and_normalize_erasing_regions(*self.tcx, self.param_env, value)
498+
.try_subst_mir_and_normalize_erasing_regions(
499+
*self.tcx,
500+
self.param_env,
501+
ty::EarlyBinder(value),
502+
)
499503
.map_err(|_| err_inval!(TooGeneric))
500504
}
501505

compiler/rustc_middle/src/ty/instance.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -594,15 +594,15 @@ impl<'tcx> Instance<'tcx> {
594594
&self,
595595
tcx: TyCtxt<'tcx>,
596596
param_env: ty::ParamEnv<'tcx>,
597-
v: T,
597+
v: EarlyBinder<T>,
598598
) -> T
599599
where
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, ty::EarlyBinder(v))
603+
tcx.subst_and_normalize_erasing_regions(substs, param_env, v)
604604
} else {
605-
tcx.normalize_erasing_regions(param_env, v)
605+
tcx.normalize_erasing_regions(param_env, v.subst_identity())
606606
}
607607
}
608608

@@ -611,15 +611,15 @@ impl<'tcx> Instance<'tcx> {
611611
&self,
612612
tcx: TyCtxt<'tcx>,
613613
param_env: ty::ParamEnv<'tcx>,
614-
v: T,
614+
v: EarlyBinder<T>,
615615
) -> Result<T, NormalizationError<'tcx>>
616616
where
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, ty::EarlyBinder(v))
620+
tcx.try_subst_and_normalize_erasing_regions(substs, param_env, v)
621621
} else {
622-
tcx.try_normalize_erasing_regions(param_env, v)
622+
tcx.try_normalize_erasing_regions(param_env, v.subst_identity())
623623
}
624624
}
625625

compiler/rustc_mir_transform/src/inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl<'tcx> Inliner<'tcx> {
180180
let Ok(callee_body) = callsite.callee.try_subst_mir_and_normalize_erasing_regions(
181181
self.tcx,
182182
self.param_env,
183-
callee_body.clone(),
183+
ty::EarlyBinder(callee_body.clone()),
184184
) else {
185185
return Err("failed to normalize callee body");
186186
};

compiler/rustc_mir_transform/src/inline/cycle.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ pub(crate) fn mir_callgraph_reachable<'tcx>(
4444
) -> bool {
4545
trace!(%caller);
4646
for &(callee, substs) in tcx.mir_inliner_callees(caller.def) {
47-
let Ok(substs) = caller.try_subst_mir_and_normalize_erasing_regions(tcx, param_env, substs) else {
47+
let Ok(substs) = caller.try_subst_mir_and_normalize_erasing_regions(
48+
tcx,
49+
param_env,
50+
ty::EarlyBinder(substs),
51+
) else {
4852
trace!(?caller, ?param_env, ?substs, "cannot normalize, skipping");
4953
continue;
5054
};

compiler/rustc_monomorphize/src/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ impl<'a, 'tcx> MirNeighborCollector<'a, 'tcx> {
677677
self.instance.subst_mir_and_normalize_erasing_regions(
678678
self.tcx,
679679
ty::ParamEnv::reveal_all(),
680-
value,
680+
ty::EarlyBinder(value),
681681
)
682682
}
683683
}

0 commit comments

Comments
 (0)