File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed
compiler/rustc_mir_transform/src Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -28,12 +28,12 @@ impl<'tcx> crate::MirPass<'tcx> for CtfeLimit {
2828 }
2929 } )
3030 . collect ( ) ;
31+
32+ let basic_blocks = body. basic_blocks . as_mut_preserves_cfg ( ) ;
3133 for index in indices {
32- insert_counter (
33- body. basic_blocks_mut ( )
34- . get_mut ( index)
35- . expect ( "basic_blocks index {index} should exist" ) ,
36- ) ;
34+ let bbdata = & mut basic_blocks[ index] ;
35+ let source_info = bbdata. terminator ( ) . source_info ;
36+ bbdata. statements . push ( Statement :: new ( source_info, StatementKind :: ConstEvalCounter ) ) ;
3737 }
3838 }
3939
@@ -53,10 +53,3 @@ fn has_back_edge(
5353 // Check if any of the dominators of the node are also the node's successor.
5454 node_data. terminator ( ) . successors ( ) . any ( |succ| doms. dominates ( succ, node) )
5555}
56-
57- fn insert_counter ( basic_block_data : & mut BasicBlockData < ' _ > ) {
58- basic_block_data. statements . push ( Statement :: new (
59- basic_block_data. terminator ( ) . source_info ,
60- StatementKind :: ConstEvalCounter ,
61- ) ) ;
62- }
You can’t perform that action at this time.
0 commit comments