Skip to content

Commit 42e31ff

Browse files
Skip shim passes if they've already been run
Looks like Generator drop shims already have `post_borrowck_cleanup` run on them. That's a bit surprising, since it means they're getting const- and maybe borrow-checked? This merits further investigation, but for now just preserve the status quo.
1 parent 71dd542 commit 42e31ff

File tree

1 file changed

+8
-0
lines changed
  • compiler/rustc_mir_transform/src

1 file changed

+8
-0
lines changed

compiler/rustc_mir_transform/src/shim.rs

+8
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ fn make_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceDef<'tcx>) -> Body<'
7575
};
7676
debug!("make_shim({:?}) = untransformed {:?}", instance, result);
7777

78+
// In some of the above cases, we seem to be invoking the passes for non-shim MIR bodies.
79+
// If that happens, there's no need to run them again.
80+
//
81+
// FIXME: Is this intentional?
82+
if result.phase >= MirPhase::Const {
83+
return result;
84+
}
85+
7886
pm::run_passes(
7987
tcx,
8088
&mut result,

0 commit comments

Comments
 (0)