File tree 1 file changed +7
-8
lines changed
compiler/rustc_mir_transform/src
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -343,6 +343,13 @@ fn mir_promoted(
343
343
body. tainted_by_errors = Some ( error_reported) ;
344
344
}
345
345
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
+
346
353
// What we need to run borrowck etc.
347
354
let promote_pass = promote_consts:: PromoteTemps :: default ( ) ;
348
355
pm:: run_passes (
@@ -352,14 +359,6 @@ fn mir_promoted(
352
359
Some ( MirPhase :: Analysis ( AnalysisPhase :: Initial ) ) ,
353
360
) ;
354
361
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
-
363
362
let promoted = promote_pass. promoted_fragments . into_inner ( ) ;
364
363
( tcx. alloc_steal_mir ( body) , tcx. alloc_steal_promoted ( promoted) )
365
364
}
You can’t perform that action at this time.
0 commit comments