This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
compiler/rustc_mir_transform/src Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -343,6 +343,13 @@ fn mir_promoted(
343343 body. tainted_by_errors = Some ( error_reported) ;
344344 }
345345
346+ let mut required_consts = Vec :: new ( ) ;
347+ let mut required_consts_visitor = RequiredConstsVisitor :: new ( & mut required_consts) ;
348+ for ( bb, bb_data) in traversal:: reverse_postorder ( & body) {
349+ required_consts_visitor. visit_basic_block_data ( bb, bb_data) ;
350+ }
351+ body. required_consts = required_consts;
352+
346353 // What we need to run borrowck etc.
347354 let promote_pass = promote_consts:: PromoteTemps :: default ( ) ;
348355 pm:: run_passes (
@@ -352,14 +359,6 @@ fn mir_promoted(
352359 Some ( MirPhase :: Analysis ( AnalysisPhase :: Initial ) ) ,
353360 ) ;
354361
355- // Promotion generates new consts; we run this after promotion to ensure they are accounted for.
356- let mut required_consts = Vec :: new ( ) ;
357- let mut required_consts_visitor = RequiredConstsVisitor :: new ( & mut required_consts) ;
358- for ( bb, bb_data) in traversal:: reverse_postorder ( & body) {
359- required_consts_visitor. visit_basic_block_data ( bb, bb_data) ;
360- }
361- body. required_consts = required_consts;
362-
363362 let promoted = promote_pass. promoted_fragments . into_inner ( ) ;
364363 ( tcx. alloc_steal_mir ( body) , tcx. alloc_steal_promoted ( promoted) )
365364}
You can’t perform that action at this time.
0 commit comments