diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2021-12-02 14:14:38 -0800 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2021-12-02 17:31:38 -0800 |
| commit | 42e31fffc40342fa269214e0dbc3550f4b64f3d3 (patch) | |
| tree | 7a347139785d5777f9bd302b9bd07e811101fc15 /compiler/rustc_mir_transform/src | |
| parent | 71dd5422acd06a9cab95c6f202dbb5c577f91ef9 (diff) | |
| download | rust-42e31fffc40342fa269214e0dbc3550f4b64f3d3.tar.gz rust-42e31fffc40342fa269214e0dbc3550f4b64f3d3.zip | |
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.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/shim.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/shim.rs b/compiler/rustc_mir_transform/src/shim.rs index b4a92064377..193a9e6ad29 100644 --- a/compiler/rustc_mir_transform/src/shim.rs +++ b/compiler/rustc_mir_transform/src/shim.rs @@ -75,6 +75,14 @@ fn make_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceDef<'tcx>) -> Body<' }; debug!("make_shim({:?}) = untransformed {:?}", instance, result); + // In some of the above cases, we seem to be invoking the passes for non-shim MIR bodies. + // If that happens, there's no need to run them again. + // + // FIXME: Is this intentional? + if result.phase >= MirPhase::Const { + return result; + } + pm::run_passes( tcx, &mut result, |
