Skip to content

Commit 8195db9

Browse files
authored
Unrolled build for rust-lang#116340
Rollup merge of rust-lang#116340 - lcnr:early-binder-skip_binder, r=compiler-errors `skip_binder` to `instantiate_identity`
2 parents b0889cb + dbc2cc8 commit 8195db9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

compiler/rustc_middle/src/ty/instance.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -617,12 +617,17 @@ impl<'tcx> Instance<'tcx> {
617617
v: EarlyBinder<T>,
618618
) -> Result<T, NormalizationError<'tcx>>
619619
where
620-
T: TypeFoldable<TyCtxt<'tcx>> + Clone,
620+
T: TypeFoldable<TyCtxt<'tcx>>,
621621
{
622622
if let Some(args) = self.args_for_mir_body() {
623623
tcx.try_instantiate_and_normalize_erasing_regions(args, param_env, v)
624624
} else {
625-
tcx.try_normalize_erasing_regions(param_env, v.skip_binder())
625+
// We're using `instantiate_identity` as e.g.
626+
// `FnPtrShim` is separately generated for every
627+
// instantiation of the `FnDef`, so the MIR body
628+
// is already instantiated. Any generic parameters it
629+
// contains are generic parameters from the caller.
630+
tcx.try_normalize_erasing_regions(param_env, v.instantiate_identity())
626631
}
627632
}
628633

0 commit comments

Comments
 (0)