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.
This commit is contained in:
commit
b4589a86cc
9 changed files with 142 additions and 42 deletions
|
@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue