about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-11-09 01:13:42 +0100
committerGitHub <noreply@github.com>2020-11-09 01:13:42 +0100
commitb4589a86ccdd39114c887eb5785c8493fc421162 (patch)
tree4b7c9b30c9ae4a1ef2f06673c366f269b3efb4b8 /compiler/rustc_codegen_ssa
parent5639d9793f1d2440bb9a8c8630f20d757a48e111 (diff)
parent8a8ee1a3ed249e4077a7ce0b88903b493419e7d7 (diff)
downloadrust-b4589a86ccdd39114c887eb5785c8493fc421162.tar.gz
rust-b4589a86ccdd39114c887eb5785c8493fc421162.zip
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.
Diffstat (limited to 'compiler/rustc_codegen_ssa')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/mod.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/mod.rs b/compiler/rustc_codegen_ssa/src/mir/mod.rs
index 84e82e88e8e..01fd1681593 100644
--- a/compiler/rustc_codegen_ssa/src/mir/mod.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/mod.rs
@@ -92,15 +92,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
         T: Copy + TypeFoldable<'tcx>,
     {
         debug!("monomorphize: self.instance={:?}", self.instance);
-        if let Some(substs) = self.instance.substs_for_mir_body() {
-            self.cx.tcx().subst_and_normalize_erasing_regions(
-                substs,
-                ty::ParamEnv::reveal_all(),
-                &value,
-            )
-        } else {
-            self.cx.tcx().normalize_erasing_regions(ty::ParamEnv::reveal_all(), *value)
-        }
+        self.instance.subst_mir_and_normalize_erasing_regions(
+            self.cx.tcx(),
+            ty::ParamEnv::reveal_all(),
+            value,
+        )
     }
 }