Rollup merge of #108154 - scottmcm:start-block-cleanup, r=compiler-errors

`BasicBlock::new(0)` -> `START_BLOCK` [no functional changes]
This commit is contained in:
Matthias Krüger 2023-02-17 12:39:07 +01:00 committed by GitHub
commit ae5473c969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 12 deletions

View File

@ -898,7 +898,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
assert_eq!(self.new_block(), START_BLOCK); assert_eq!(self.new_block(), START_BLOCK);
self.visit_rvalue( self.visit_rvalue(
&mut rvalue, &mut rvalue,
Location { block: BasicBlock::new(0), statement_index: usize::MAX }, Location { block: START_BLOCK, statement_index: usize::MAX },
); );
let span = self.promoted.span; let span = self.promoted.span;

View File

@ -323,7 +323,7 @@ macro_rules! make_mir_visitor {
self.visit_source_scope($(& $mutability)? *parent_scope); self.visit_source_scope($(& $mutability)? *parent_scope);
} }
if let Some((callee, callsite_span)) = inlined { if let Some((callee, callsite_span)) = inlined {
let location = START_BLOCK.start_location(); let location = Location::START;
self.visit_span($(& $mutability)? *callsite_span); self.visit_span($(& $mutability)? *callsite_span);
@ -837,7 +837,7 @@ macro_rules! make_mir_visitor {
} = var_debug_info; } = var_debug_info;
self.visit_source_info(source_info); self.visit_source_info(source_info);
let location = START_BLOCK.start_location(); let location = Location::START;
match value { match value {
VarDebugInfoContents::Const(c) => self.visit_constant(c, location), VarDebugInfoContents::Const(c) => self.visit_constant(c, location),
VarDebugInfoContents::Place(place) => VarDebugInfoContents::Place(place) =>
@ -1026,7 +1026,7 @@ macro_rules! super_body {
$self.visit_span($(& $mutability)? $body.span); $self.visit_span($(& $mutability)? $body.span);
for const_ in &$($mutability)? $body.required_consts { for const_ in &$($mutability)? $body.required_consts {
let location = START_BLOCK.start_location(); let location = Location::START;
$self.visit_constant(const_, location); $self.visit_constant(const_, location);
} }
} }

View File

@ -136,8 +136,8 @@ use rustc_index::bit_set::BitSet;
use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor}; use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor};
use rustc_middle::mir::{dump_mir, PassWhere}; use rustc_middle::mir::{dump_mir, PassWhere};
use rustc_middle::mir::{ use rustc_middle::mir::{
traversal, BasicBlock, Body, InlineAsmOperand, Local, LocalKind, Location, Operand, Place, traversal, Body, InlineAsmOperand, Local, LocalKind, Location, Operand, Place, Rvalue,
Rvalue, Statement, StatementKind, TerminatorKind, Statement, StatementKind, TerminatorKind,
}; };
use rustc_middle::ty::TyCtxt; use rustc_middle::ty::TyCtxt;
use rustc_mir_dataflow::impls::MaybeLiveLocals; use rustc_mir_dataflow::impls::MaybeLiveLocals;
@ -468,7 +468,7 @@ impl<'a, 'body, 'alloc, 'tcx> FilterInformation<'a, 'body, 'alloc, 'tcx> {
// to reuse the allocation. // to reuse the allocation.
write_info: write_info_alloc, write_info: write_info_alloc,
// Doesn't matter what we put here, will be overwritten before being used // Doesn't matter what we put here, will be overwritten before being used
at: Location { block: BasicBlock::from_u32(0), statement_index: 0 }, at: Location::START,
}; };
this.internal_filter_liveness(); this.internal_filter_liveness();
} }

View File

@ -487,7 +487,7 @@ fn transform_async_context<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
let get_context_def_id = tcx.require_lang_item(LangItem::GetContext, None); let get_context_def_id = tcx.require_lang_item(LangItem::GetContext, None);
for bb in BasicBlock::new(0)..body.basic_blocks.next_index() { for bb in START_BLOCK..body.basic_blocks.next_index() {
let bb_data = &body[bb]; let bb_data = &body[bb];
if bb_data.is_cleanup { if bb_data.is_cleanup {
continue; continue;
@ -1255,7 +1255,7 @@ fn create_generator_resume_function<'tcx>(
use rustc_middle::mir::AssertKind::{ResumedAfterPanic, ResumedAfterReturn}; use rustc_middle::mir::AssertKind::{ResumedAfterPanic, ResumedAfterReturn};
// Jump to the entry point on the unresumed // Jump to the entry point on the unresumed
cases.insert(0, (UNRESUMED, BasicBlock::new(0))); cases.insert(0, (UNRESUMED, START_BLOCK));
// Panic when resumed on the returned or poisoned state // Panic when resumed on the returned or poisoned state
let generator_kind = body.generator_kind().unwrap(); let generator_kind = body.generator_kind().unwrap();
@ -1481,7 +1481,7 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
// When first entering the generator, move the resume argument into its new local. // When first entering the generator, move the resume argument into its new local.
let source_info = SourceInfo::outermost(body.span); let source_info = SourceInfo::outermost(body.span);
let stmts = &mut body.basic_blocks_mut()[BasicBlock::new(0)].statements; let stmts = &mut body.basic_blocks_mut()[START_BLOCK].statements;
stmts.insert( stmts.insert(
0, 0,
Statement { Statement {

View File

@ -96,7 +96,7 @@ fn inline<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) -> bool {
history: Vec::new(), history: Vec::new(),
changed: false, changed: false,
}; };
let blocks = BasicBlock::new(0)..body.basic_blocks.next_index(); let blocks = START_BLOCK..body.basic_blocks.next_index();
this.process_blocks(body, blocks); this.process_blocks(body, blocks);
this.changed this.changed
} }

View File

@ -496,7 +496,7 @@ impl UsedLocals {
self.increment = false; self.increment = false;
// The location of the statement is irrelevant. // The location of the statement is irrelevant.
let location = Location { block: START_BLOCK, statement_index: 0 }; let location = Location::START;
self.visit_statement(statement, location); self.visit_statement(statement, location);
} }