Skip to content

Commit

Permalink
Rollup merge of rust-lang#78674 - tmiasko:inline-substs-for-mir-body,…
Browse files Browse the repository at this point in the history
… 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 rust-lang#78529.
Resolves rust-lang#78560.
  • Loading branch information
Dylan-DPC authored Nov 9, 2020
2 parents 8a097f7 + f7e11cb commit 806538f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,11 @@ impl<'tcx, M: Module> FunctionCx<'_, 'tcx, M> {
where
T: TypeFoldable<'tcx> + Copy,
{
if let Some(substs) = self.instance.substs_for_mir_body() {
self.tcx
.subst_and_normalize_erasing_regions(substs, ty::ParamEnv::reveal_all(), value)
} else {
self.tcx
.normalize_erasing_regions(ty::ParamEnv::reveal_all(), *value)
}
self.instance.subst_mir_and_normalize_erasing_regions(
self.tcx,
ty::ParamEnv::reveal_all(),
value
)
}

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

0 comments on commit 806538f

Please sign in to comment.