Skip to content

Commit ae5473c

Browse files
authored
Rollup merge of #108154 - scottmcm:start-block-cleanup, r=compiler-errors
`BasicBlock::new(0)` -> `START_BLOCK` [no functional changes]
2 parents 392b150 + c946494 commit ae5473c

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

compiler/rustc_const_eval/src/transform/promote_consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
898898
assert_eq!(self.new_block(), START_BLOCK);
899899
self.visit_rvalue(
900900
&mut rvalue,
901-
Location { block: BasicBlock::new(0), statement_index: usize::MAX },
901+
Location { block: START_BLOCK, statement_index: usize::MAX },
902902
);
903903

904904
let span = self.promoted.span;

compiler/rustc_middle/src/mir/visit.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ macro_rules! make_mir_visitor {
323323
self.visit_source_scope($(& $mutability)? *parent_scope);
324324
}
325325
if let Some((callee, callsite_span)) = inlined {
326-
let location = START_BLOCK.start_location();
326+
let location = Location::START;
327327

328328
self.visit_span($(& $mutability)? *callsite_span);
329329

@@ -837,7 +837,7 @@ macro_rules! make_mir_visitor {
837837
} = var_debug_info;
838838

839839
self.visit_source_info(source_info);
840-
let location = START_BLOCK.start_location();
840+
let location = Location::START;
841841
match value {
842842
VarDebugInfoContents::Const(c) => self.visit_constant(c, location),
843843
VarDebugInfoContents::Place(place) =>
@@ -1026,7 +1026,7 @@ macro_rules! super_body {
10261026
$self.visit_span($(& $mutability)? $body.span);
10271027

10281028
for const_ in &$($mutability)? $body.required_consts {
1029-
let location = START_BLOCK.start_location();
1029+
let location = Location::START;
10301030
$self.visit_constant(const_, location);
10311031
}
10321032
}

compiler/rustc_mir_transform/src/dest_prop.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ use rustc_index::bit_set::BitSet;
136136
use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor};
137137
use rustc_middle::mir::{dump_mir, PassWhere};
138138
use rustc_middle::mir::{
139-
traversal, BasicBlock, Body, InlineAsmOperand, Local, LocalKind, Location, Operand, Place,
140-
Rvalue, Statement, StatementKind, TerminatorKind,
139+
traversal, Body, InlineAsmOperand, Local, LocalKind, Location, Operand, Place, Rvalue,
140+
Statement, StatementKind, TerminatorKind,
141141
};
142142
use rustc_middle::ty::TyCtxt;
143143
use rustc_mir_dataflow::impls::MaybeLiveLocals;
@@ -468,7 +468,7 @@ impl<'a, 'body, 'alloc, 'tcx> FilterInformation<'a, 'body, 'alloc, 'tcx> {
468468
// to reuse the allocation.
469469
write_info: write_info_alloc,
470470
// Doesn't matter what we put here, will be overwritten before being used
471-
at: Location { block: BasicBlock::from_u32(0), statement_index: 0 },
471+
at: Location::START,
472472
};
473473
this.internal_filter_liveness();
474474
}

compiler/rustc_mir_transform/src/generator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ fn transform_async_context<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
487487

488488
let get_context_def_id = tcx.require_lang_item(LangItem::GetContext, None);
489489

490-
for bb in BasicBlock::new(0)..body.basic_blocks.next_index() {
490+
for bb in START_BLOCK..body.basic_blocks.next_index() {
491491
let bb_data = &body[bb];
492492
if bb_data.is_cleanup {
493493
continue;
@@ -1255,7 +1255,7 @@ fn create_generator_resume_function<'tcx>(
12551255
use rustc_middle::mir::AssertKind::{ResumedAfterPanic, ResumedAfterReturn};
12561256

12571257
// Jump to the entry point on the unresumed
1258-
cases.insert(0, (UNRESUMED, BasicBlock::new(0)));
1258+
cases.insert(0, (UNRESUMED, START_BLOCK));
12591259

12601260
// Panic when resumed on the returned or poisoned state
12611261
let generator_kind = body.generator_kind().unwrap();
@@ -1481,7 +1481,7 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
14811481

14821482
// When first entering the generator, move the resume argument into its new local.
14831483
let source_info = SourceInfo::outermost(body.span);
1484-
let stmts = &mut body.basic_blocks_mut()[BasicBlock::new(0)].statements;
1484+
let stmts = &mut body.basic_blocks_mut()[START_BLOCK].statements;
14851485
stmts.insert(
14861486
0,
14871487
Statement {

compiler/rustc_mir_transform/src/inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn inline<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) -> bool {
9696
history: Vec::new(),
9797
changed: false,
9898
};
99-
let blocks = BasicBlock::new(0)..body.basic_blocks.next_index();
99+
let blocks = START_BLOCK..body.basic_blocks.next_index();
100100
this.process_blocks(body, blocks);
101101
this.changed
102102
}

compiler/rustc_mir_transform/src/simplify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ impl UsedLocals {
496496
self.increment = false;
497497

498498
// The location of the statement is irrelevant.
499-
let location = Location { block: START_BLOCK, statement_index: 0 };
499+
let location = Location::START;
500500
self.visit_statement(statement, location);
501501
}
502502

0 commit comments

Comments
 (0)