diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2021-09-15 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2021-09-15 18:48:29 +0200 |
| commit | c39d7599a3a346a571056d3d02081cccc8e62d7f (patch) | |
| tree | bcd2ef58abfeb3630577cb2bd2f7e2496022e2b5 /compiler/rustc_mir_transform/src | |
| parent | 2c7bc5e33c25e29058cbafefe680da8d5e9220e9 (diff) | |
| download | rust-c39d7599a3a346a571056d3d02081cccc8e62d7f.tar.gz rust-c39d7599a3a346a571056d3d02081cccc8e62d7f.zip | |
Disable RemoveZsts in generators to avoid query cycles
Querying layout of a generator requires its optimized MIR. Thus computing layout during MIR optimization of a generator might create a query cycle. Disable RemoveZsts in generators to avoid the issue (similar approach is used in ConstProp transform already).
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/remove_zsts.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/remove_zsts.rs b/compiler/rustc_mir_transform/src/remove_zsts.rs index 25e3c52132c..d93ffa38c69 100644 --- a/compiler/rustc_mir_transform/src/remove_zsts.rs +++ b/compiler/rustc_mir_transform/src/remove_zsts.rs @@ -9,6 +9,10 @@ pub struct RemoveZsts; impl<'tcx> MirPass<'tcx> for RemoveZsts { fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { + // Avoid query cycles (generators require optimized MIR for layout). + if tcx.type_of(body.source.def_id()).is_generator() { + return; + } let param_env = tcx.param_env(body.source.def_id()); let (basic_blocks, local_decls) = body.basic_blocks_and_local_decls_mut(); for block in basic_blocks.iter_mut() { |
