Skip to content

Commit 806538f

Browse files
authored
Rollup merge of #78674 - tmiasko:inline-substs-for-mir-body, r=oli-obk
inliner: Use substs_for_mir_body Changes from 68965 extended the kind of instances that are being inlined. For some of those, the `instance_mir` returns a MIR body that is already expressed in terms of the types found in substitution array, and doesn't need further substitution. Use `substs_for_mir_body` to take that into account. Resolves #78529. Resolves #78560.
2 parents 8a097f7 + f7e11cb commit 806538f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/common.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,11 @@ impl<'tcx, M: Module> FunctionCx<'_, 'tcx, M> {
361361
where
362362
T: TypeFoldable<'tcx> + Copy,
363363
{
364-
if let Some(substs) = self.instance.substs_for_mir_body() {
365-
self.tcx
366-
.subst_and_normalize_erasing_regions(substs, ty::ParamEnv::reveal_all(), value)
367-
} else {
368-
self.tcx
369-
.normalize_erasing_regions(ty::ParamEnv::reveal_all(), *value)
370-
}
364+
self.instance.subst_mir_and_normalize_erasing_regions(
365+
self.tcx,
366+
ty::ParamEnv::reveal_all(),
367+
value
368+
)
371369
}
372370

373371
pub(crate) fn clif_type(&self, ty: Ty<'tcx>) -> Option<Type> {

0 commit comments

Comments
 (0)