diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs index b04c28cde57..73dd24059a5 100644 --- a/src/librustc/mir/visit.rs +++ b/src/librustc/mir/visit.rs @@ -88,32 +88,28 @@ macro_rules! make_mir_visitor { } fn visit_statement(&mut self, - block: BasicBlock, statement: & $($mutability)? Statement<'tcx>, location: Location) { - self.super_statement(block, statement, location); + self.super_statement(statement, location); } fn visit_assign(&mut self, - block: BasicBlock, place: & $($mutability)? Place<'tcx>, rvalue: & $($mutability)? Rvalue<'tcx>, location: Location) { - self.super_assign(block, place, rvalue, location); + self.super_assign(place, rvalue, location); } fn visit_terminator(&mut self, - block: BasicBlock, terminator: & $($mutability)? Terminator<'tcx>, location: Location) { - self.super_terminator(block, terminator, location); + self.super_terminator(terminator, location); } fn visit_terminator_kind(&mut self, - block: BasicBlock, kind: & $($mutability)? TerminatorKind<'tcx>, location: Location) { - self.super_terminator_kind(block, kind, location); + self.super_terminator_kind(kind, location); } fn visit_assert_message(&mut self, @@ -327,13 +323,13 @@ macro_rules! make_mir_visitor { let mut index = 0; for statement in statements { let location = Location { block: block, statement_index: index }; - self.visit_statement(block, statement, location); + self.visit_statement(statement, location); index += 1; } if let Some(terminator) = terminator { let location = Location { block: block, statement_index: index }; - self.visit_terminator(block, terminator, location); + self.visit_terminator(terminator, location); } } @@ -350,7 +346,6 @@ macro_rules! make_mir_visitor { } fn super_statement(&mut self, - block: BasicBlock, statement: & $($mutability)? Statement<'tcx>, location: Location) { let Statement { @@ -361,7 +356,7 @@ macro_rules! make_mir_visitor { self.visit_source_info(source_info); match kind { StatementKind::Assign(place, rvalue) => { - self.visit_assign(block, place, rvalue, location); + self.visit_assign(place, rvalue, location); } StatementKind::FakeRead(_, place) => { self.visit_place( @@ -415,7 +410,6 @@ macro_rules! make_mir_visitor { } fn super_assign(&mut self, - _block: BasicBlock, place: &$($mutability)? Place<'tcx>, rvalue: &$($mutability)? Rvalue<'tcx>, location: Location) { @@ -428,19 +422,18 @@ macro_rules! make_mir_visitor { } fn super_terminator(&mut self, - block: BasicBlock, terminator: &$($mutability)? Terminator<'tcx>, location: Location) { let Terminator { source_info, kind } = terminator; self.visit_source_info(source_info); - self.visit_terminator_kind(block, kind, location); + self.visit_terminator_kind(kind, location); } fn super_terminator_kind(&mut self, - block: BasicBlock, kind: & $($mutability)? TerminatorKind<'tcx>, source_location: Location) { + let block = source_location.block; match kind { TerminatorKind::Goto { target } => { self.visit_branch(block, *target); @@ -890,12 +883,12 @@ macro_rules! make_mir_visitor { let basic_block = & $($mutability)? mir[location.block]; if basic_block.statements.len() == location.statement_index { if let Some(ref $($mutability)? terminator) = basic_block.terminator { - self.visit_terminator(location.block, terminator, location) + self.visit_terminator(terminator, location) } } else { let statement = & $($mutability)? basic_block.statements[location.statement_index]; - self.visit_statement(location.block, statement, location) + self.visit_statement(statement, location) } } } @@ -912,21 +905,21 @@ pub trait MirVisitable<'tcx> { impl<'tcx> MirVisitable<'tcx> for Statement<'tcx> { fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>) { - visitor.visit_statement(location.block, self, location) + visitor.visit_statement(self, location) } } impl<'tcx> MirVisitable<'tcx> for Terminator<'tcx> { fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>) { - visitor.visit_terminator(location.block, self, location) + visitor.visit_terminator(self, location) } } impl<'tcx> MirVisitable<'tcx> for Option> { fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>) { - visitor.visit_terminator(location.block, self.as_ref().unwrap(), location) + visitor.visit_terminator(self.as_ref().unwrap(), location) } } diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs index 8253a167245..c3eac4edd0a 100644 --- a/src/librustc_codegen_ssa/mir/analyze.rs +++ b/src/librustc_codegen_ssa/mir/analyze.rs @@ -97,11 +97,10 @@ impl> LocalAnalyzer<'mir, 'a, 'tcx, Bx> { impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx> for LocalAnalyzer<'mir, 'a, 'tcx, Bx> { fn visit_assign(&mut self, - block: mir::BasicBlock, place: &mir::Place<'tcx>, rvalue: &mir::Rvalue<'tcx>, location: Location) { - debug!("visit_assign(block={:?}, place={:?}, rvalue={:?})", block, place, rvalue); + debug!("visit_assign(place={:?}, rvalue={:?})", place, rvalue); if let mir::Place::Base(mir::PlaceBase::Local(index)) = *place { self.assign(index, location); @@ -120,7 +119,6 @@ impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx> } fn visit_terminator_kind(&mut self, - block: mir::BasicBlock, kind: &mir::TerminatorKind<'tcx>, location: Location) { let check = match *kind { @@ -148,7 +146,7 @@ impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx> } } - self.super_terminator_kind(block, kind, location); + self.super_terminator_kind(kind, location); } fn visit_place(&mut self, diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index 918192395c3..f7d3aef4d76 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -184,7 +184,6 @@ struct GatherBorrows<'a, 'gcx: 'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> { fn visit_assign( &mut self, - block: mir::BasicBlock, assigned_place: &mir::Place<'tcx>, rvalue: &mir::Rvalue<'tcx>, location: mir::Location, @@ -215,7 +214,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> { } } - self.super_assign(block, assigned_place, rvalue, location) + self.super_assign(assigned_place, rvalue, location) } fn visit_local( @@ -287,15 +286,6 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> { return self.super_rvalue(rvalue, location); } - - fn visit_statement( - &mut self, - block: mir::BasicBlock, - statement: &mir::Statement<'tcx>, - location: Location, - ) { - return self.super_statement(block, statement, location); - } } impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> { diff --git a/src/librustc_mir/borrow_check/nll/constraint_generation.rs b/src/librustc_mir/borrow_check/nll/constraint_generation.rs index bf9cff1e4ae..bfba9738a64 100644 --- a/src/librustc_mir/borrow_check/nll/constraint_generation.rs +++ b/src/librustc_mir/borrow_check/nll/constraint_generation.rs @@ -100,7 +100,6 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx fn visit_statement( &mut self, - block: BasicBlock, statement: &Statement<'tcx>, location: Location, ) { @@ -117,12 +116,11 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx )); } - self.super_statement(block, statement, location); + self.super_statement(statement, location); } fn visit_assign( &mut self, - block: BasicBlock, place: &Place<'tcx>, rvalue: &Rvalue<'tcx>, location: Location, @@ -141,12 +139,11 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx } } - self.super_assign(block, place, rvalue, location); + self.super_assign(place, rvalue, location); } fn visit_terminator( &mut self, - block: BasicBlock, terminator: &Terminator<'tcx>, location: Location, ) { @@ -167,7 +164,7 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx } } - self.super_terminator(block, terminator, location); + self.super_terminator(terminator, location); } fn visit_ascribe_user_ty( diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs index 8cbf68c476a..999b43d90d0 100644 --- a/src/librustc_mir/borrow_check/nll/invalidation.rs +++ b/src/librustc_mir/borrow_check/nll/invalidation.rs @@ -58,7 +58,6 @@ struct InvalidationGenerator<'cx, 'tcx: 'cx, 'gcx: 'tcx> { impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> { fn visit_statement( &mut self, - block: BasicBlock, statement: &Statement<'tcx>, location: Location, ) { @@ -134,13 +133,12 @@ impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> { } } - self.super_statement(block, statement, location); + self.super_statement(statement, location); } fn visit_terminator( &mut self, - block: BasicBlock, - terminator: &Terminator<'tcx>, + kind: &Terminator<'tcx>, location: Location ) { self.check_activations(location); @@ -258,7 +256,7 @@ impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> { } } - self.super_terminator(block, terminator, location); + self.super_terminator(terminator, location); } } diff --git a/src/librustc_mir/borrow_check/used_muts.rs b/src/librustc_mir/borrow_check/used_muts.rs index b102bced0e3..f3b33c411a6 100644 --- a/src/librustc_mir/borrow_check/used_muts.rs +++ b/src/librustc_mir/borrow_check/used_muts.rs @@ -1,6 +1,6 @@ use rustc::mir::visit::{PlaceContext, Visitor}; use rustc::mir::{ - BasicBlock, Local, Location, Place, PlaceBase, Statement, StatementKind, TerminatorKind + Local, Location, Place, PlaceBase, Statement, StatementKind, TerminatorKind }; use rustc_data_structures::fx::FxHashSet; @@ -55,7 +55,6 @@ struct GatherUsedMutsVisitor<'visit, 'cx: 'visit, 'gcx: 'tcx, 'tcx: 'cx> { impl<'visit, 'cx, 'gcx, 'tcx> Visitor<'tcx> for GatherUsedMutsVisitor<'visit, 'cx, 'gcx, 'tcx> { fn visit_terminator_kind( &mut self, - _block: BasicBlock, kind: &TerminatorKind<'tcx>, _location: Location, ) { @@ -77,7 +76,6 @@ impl<'visit, 'cx, 'gcx, 'tcx> Visitor<'tcx> for GatherUsedMutsVisitor<'visit, 'c fn visit_statement( &mut self, - _block: BasicBlock, statement: &Statement<'tcx>, _location: Location, ) { diff --git a/src/librustc_mir/dataflow/impls/borrowed_locals.rs b/src/librustc_mir/dataflow/impls/borrowed_locals.rs index 9d4600d13ac..42c2387b705 100644 --- a/src/librustc_mir/dataflow/impls/borrowed_locals.rs +++ b/src/librustc_mir/dataflow/impls/borrowed_locals.rs @@ -44,7 +44,7 @@ impl<'a, 'tcx> BitDenotation<'tcx> for HaveBeenBorrowedLocals<'a, 'tcx> { BorrowedLocalsVisitor { sets, - }.visit_statement(loc.block, stmt, loc); + }.visit_statement(stmt, loc); // StorageDead invalidates all borrows and raw pointers to a local match stmt.kind { @@ -58,7 +58,7 @@ impl<'a, 'tcx> BitDenotation<'tcx> for HaveBeenBorrowedLocals<'a, 'tcx> { loc: Location) { BorrowedLocalsVisitor { sets, - }.visit_terminator(loc.block, self.mir[loc.block].terminator(), loc); + }.visit_terminator(self.mir[loc.block].terminator(), loc); } fn propagate_call_return( diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 47fe136e0e4..d5c5c3eda1d 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -615,7 +615,6 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { } fn visit_terminator_kind(&mut self, - block: mir::BasicBlock, kind: &mir::TerminatorKind<'tcx>, location: Location) { debug!("visiting terminator {:?} @ {:?}", kind, location); @@ -654,7 +653,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { mir::TerminatorKind::FalseUnwind { .. } => bug!(), } - self.super_terminator_kind(block, kind, location); + self.super_terminator_kind(kind, location); } fn visit_place(&mut self, diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 87c02b7f01d..e072fafb1df 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -65,7 +65,6 @@ impl<'a, 'gcx, 'tcx> UnsafetyChecker<'a, 'tcx> { impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { fn visit_terminator(&mut self, - block: BasicBlock, terminator: &Terminator<'tcx>, location: Location) { @@ -97,11 +96,10 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { } } } - self.super_terminator(block, terminator, location); + self.super_terminator(terminator, location); } fn visit_statement(&mut self, - block: BasicBlock, statement: &Statement<'tcx>, location: Location) { @@ -124,7 +122,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { UnsafetyViolationKind::General) }, } - self.super_statement(block, statement, location); + self.super_statement(statement, location); } fn visit_rvalue(&mut self, diff --git a/src/librustc_mir/transform/cleanup_post_borrowck.rs b/src/librustc_mir/transform/cleanup_post_borrowck.rs index 349b27523a0..64fd0b13656 100644 --- a/src/librustc_mir/transform/cleanup_post_borrowck.rs +++ b/src/librustc_mir/transform/cleanup_post_borrowck.rs @@ -16,7 +16,7 @@ //! [`FakeRead`]: rustc::mir::StatementKind::FakeRead //! [`Nop`]: rustc::mir::StatementKind::Nop -use rustc::mir::{BasicBlock, BorrowKind, Rvalue, Location, Mir}; +use rustc::mir::{BorrowKind, Rvalue, Location, Mir}; use rustc::mir::{Statement, StatementKind}; use rustc::mir::visit::MutVisitor; use rustc::ty::TyCtxt; @@ -38,7 +38,6 @@ impl MirPass for CleanupNonCodegenStatements { impl<'tcx> MutVisitor<'tcx> for DeleteNonCodegenStatements { fn visit_statement(&mut self, - block: BasicBlock, statement: &mut Statement<'tcx>, location: Location) { match statement.kind { @@ -47,6 +46,6 @@ impl<'tcx> MutVisitor<'tcx> for DeleteNonCodegenStatements { | StatementKind::FakeRead(..) => statement.make_nop(), _ => (), } - self.super_statement(block, statement, location); + self.super_statement(statement, location); } } diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index b5bdc9e1c8c..75b9a6bc4ff 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -4,7 +4,7 @@ use rustc::hir::def::Def; use rustc::mir::{Constant, Location, Place, PlaceBase, Mir, Operand, Rvalue, Local}; -use rustc::mir::{NullOp, UnOp, StatementKind, Statement, BasicBlock, LocalKind, Static, StaticKind}; +use rustc::mir::{NullOp, UnOp, StatementKind, Statement, LocalKind, Static, StaticKind}; use rustc::mir::{TerminatorKind, ClearCrossCrate, SourceInfo, BinOp, ProjectionElem}; use rustc::mir::visit::{Visitor, PlaceContext, MutatingUseContext, NonMutatingUseContext}; use rustc::mir::interpret::{InterpError, Scalar, GlobalId, EvalResult}; @@ -549,7 +549,6 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { fn visit_statement( &mut self, - block: BasicBlock, statement: &Statement<'tcx>, location: Location, ) { @@ -571,16 +570,15 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { } } } - self.super_statement(block, statement, location); + self.super_statement(statement, location); } fn visit_terminator_kind( &mut self, - block: BasicBlock, kind: &TerminatorKind<'tcx>, location: Location, ) { - self.super_terminator_kind(block, kind, location); + self.super_terminator_kind(kind, location); let source_info = *self.mir.source_info(location); if let TerminatorKind::Assert { expected, msg, cond, .. } = kind { if let Some(value) = self.eval_operand(cond, source_info) { @@ -601,7 +599,7 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { }, Operand::Constant(_) => {} } - let span = self.mir[block] + let span = self.mir[location.block] .terminator .as_ref() .unwrap() diff --git a/src/librustc_mir/transform/erase_regions.rs b/src/librustc_mir/transform/erase_regions.rs index a853f8d92be..924428deaee 100644 --- a/src/librustc_mir/transform/erase_regions.rs +++ b/src/librustc_mir/transform/erase_regions.rs @@ -41,10 +41,9 @@ impl<'a, 'tcx> MutVisitor<'tcx> for EraseRegionsVisitor<'a, 'tcx> { } fn visit_statement(&mut self, - block: BasicBlock, statement: &mut Statement<'tcx>, location: Location) { - self.super_statement(block, statement, location); + self.super_statement(statement, location); } } diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 2b909feb960..ba802370183 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -369,7 +369,6 @@ struct StorageIgnored(liveness::LiveVarSet); impl<'tcx> Visitor<'tcx> for StorageIgnored { fn visit_statement(&mut self, - _block: BasicBlock, statement: &Statement<'tcx>, _location: Location) { match statement.kind { diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index e96a40ad2f0..de1d424108d 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -723,9 +723,9 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> { } } - fn visit_terminator_kind(&mut self, block: BasicBlock, + fn visit_terminator_kind(&mut self, kind: &mut TerminatorKind<'tcx>, loc: Location) { - self.super_terminator_kind(block, kind, loc); + self.super_terminator_kind(kind, loc); match *kind { TerminatorKind::GeneratorDrop | diff --git a/src/librustc_mir/transform/no_landing_pads.rs b/src/librustc_mir/transform/no_landing_pads.rs index 089d9b9b544..d39f76a9901 100644 --- a/src/librustc_mir/transform/no_landing_pads.rs +++ b/src/librustc_mir/transform/no_landing_pads.rs @@ -25,12 +25,11 @@ pub fn no_landing_pads<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &mut Mir<'tcx impl<'tcx> MutVisitor<'tcx> for NoLandingPads { fn visit_terminator(&mut self, - bb: BasicBlock, terminator: &mut Terminator<'tcx>, location: Location) { if let Some(unwind) = terminator.kind.unwind_mut() { unwind.take(); } - self.super_terminator(bb, terminator, location); + self.super_terminator(terminator, location); } } diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index bbcdd2c1812..c30666e5380 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -1182,10 +1182,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { } fn visit_terminator_kind(&mut self, - bb: BasicBlock, kind: &TerminatorKind<'tcx>, location: Location) { - debug!("visit_terminator_kind: bb={:?} kind={:?} location={:?}", bb, kind, location); + debug!("visit_terminator_kind: kind={:?} location={:?}", kind, location); if let TerminatorKind::Call { ref func, ref args, ref destination, .. } = *kind { if let Some((ref dest, _)) = *destination { self.assign(dest, ValueSource::Call { @@ -1313,7 +1312,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { continue; } - let candidate = Candidate::Argument { bb, index: i }; + let candidate = Candidate::Argument { bb: location.block, index: i }; // Since the argument is required to be constant, // we care about constness, not promotability. // If we checked for promotability, we'd miss out on @@ -1346,7 +1345,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { self.visit_operand(arg, location); } } else if let TerminatorKind::Drop { location: ref place, .. } = *kind { - self.super_terminator_kind(bb, kind, location); + self.super_terminator_kind(kind, location); // Deny *any* live drops anywhere other than functions. if self.mode != Mode::Fn { @@ -1377,12 +1376,11 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { } } else { // Qualify any operands inside other terminators. - self.super_terminator_kind(bb, kind, location); + self.super_terminator_kind(kind, location); } } fn visit_assign(&mut self, - _: BasicBlock, dest: &Place<'tcx>, rvalue: &Rvalue<'tcx>, location: Location) { @@ -1397,11 +1395,11 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { self.span = source_info.span; } - fn visit_statement(&mut self, bb: BasicBlock, statement: &Statement<'tcx>, location: Location) { - debug!("visit_statement: bb={:?} statement={:?} location={:?}", bb, statement, location); + fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) { + debug!("visit_statement: statement={:?} location={:?}", statement, location); match statement.kind { StatementKind::Assign(..) => { - self.super_statement(bb, statement, location); + self.super_statement(statement, location); } // FIXME(eddyb) should these really do nothing? StatementKind::FakeRead(..) | @@ -1414,14 +1412,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { StatementKind::Nop => {} } } - - fn visit_terminator(&mut self, - bb: BasicBlock, - terminator: &Terminator<'tcx>, - location: Location) { - debug!("visit_terminator: bb={:?} terminator={:?} location={:?}", bb, terminator, location); - self.super_terminator(bb, terminator, location); - } } pub fn provide(providers: &mut Providers<'_>) { diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index 616944dd7ef..cb23abd8a0d 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -58,7 +58,6 @@ struct UniformArrayMoveOutVisitor<'a, 'tcx: 'a> { impl<'a, 'tcx> Visitor<'tcx> for UniformArrayMoveOutVisitor<'a, 'tcx> { fn visit_assign(&mut self, - block: BasicBlock, dst_place: &Place<'tcx>, rvalue: &Rvalue<'tcx>, location: Location) { @@ -82,7 +81,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UniformArrayMoveOutVisitor<'a, 'tcx> { } } } - self.super_assign(block, dst_place, rvalue, location) + self.super_assign(dst_place, rvalue, location) } } @@ -294,14 +293,13 @@ struct RestoreDataCollector { impl<'tcx> Visitor<'tcx> for RestoreDataCollector { fn visit_assign(&mut self, - block: BasicBlock, place: &Place<'tcx>, rvalue: &Rvalue<'tcx>, location: Location) { if let Rvalue::Aggregate(box AggregateKind::Array(_), _) = *rvalue { self.candidates.push(location); } - self.super_assign(block, place, rvalue, location) + self.super_assign(place, rvalue, location) } fn visit_local(&mut self, diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index cbdd50cf405..29f281fb8d4 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -247,9 +247,9 @@ fn block<'tcx>( // Visit the various parts of the basic block in reverse. If we go // forward, the logic in `add_def` and `add_use` would be wrong. - visitor.visit_terminator(BasicBlock::new(0), b.terminator(), dummy_location); + visitor.visit_terminator(b.terminator(), dummy_location); for statement in b.statements.iter().rev() { - visitor.visit_statement(BasicBlock::new(0), statement, dummy_location); + visitor.visit_statement(statement, dummy_location); } visitor.defs_uses diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs index 1f55a728f9c..6c377684bee 100644 --- a/src/librustc_mir/util/pretty.rs +++ b/src/librustc_mir/util/pretty.rs @@ -337,7 +337,7 @@ where )?; write_extra(tcx, w, |visitor| { - visitor.visit_statement(current_location.block, statement, current_location); + visitor.visit_statement(statement, current_location); })?; extra_data(PassWhere::AfterLocation(current_location), w)?; @@ -358,7 +358,7 @@ where )?; write_extra(tcx, w, |visitor| { - visitor.visit_terminator(current_location.block, data.terminator(), current_location); + visitor.visit_terminator(data.terminator(), current_location); })?; extra_data(PassWhere::AfterLocation(current_location), w)?;