diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-11-06 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-11-06 00:00:00 +0000 |
| commit | f7e11cba36abb4da04497c7db9c536df78c3cc51 (patch) | |
| tree | 55f6fa26b76d3c76fe920373e10a0a0d0d39c792 | |
| parent | 6e96e10f9363dc792acb02ff616aaca36764805d (diff) | |
| download | rust-f7e11cba36abb4da04497c7db9c536df78c3cc51.tar.gz rust-f7e11cba36abb4da04497c7db9c536df78c3cc51.zip | |
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.
| -rw-r--r-- | src/common.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/common.rs b/src/common.rs index eda77bf19d3..466758f2f86 100644 --- a/src/common.rs +++ b/src/common.rs @@ -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> { |
