Rollup merge of #57634 - oli-obk:remove_unused_argument, r=davidtwco
Remove an unused function argument The only use was a debug printing, which might help someone with debugging dataflow problems, but seems otherwise useless
This commit is contained in:
commit
e00932a38d
@ -35,11 +35,9 @@ use syntax::ast::{NodeId, CRATE_NODE_ID, Ident, Name, Attribute};
|
||||
use syntax_pos::Span;
|
||||
use hir::*;
|
||||
use hir::def::Def;
|
||||
use hir::map::{self, Map};
|
||||
use hir::map::Map;
|
||||
use super::itemlikevisit::DeepVisitor;
|
||||
|
||||
use std::cmp;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum FnKind<'a> {
|
||||
/// `#[xxx] pub async/const/extern "Abi" fn foo()`
|
||||
@ -1133,57 +1131,3 @@ pub fn walk_defaultness<'v, V: Visitor<'v>>(_: &mut V, _: &'v Defaultness) {
|
||||
// the right thing to do, should content be added in the future,
|
||||
// would be to walk it.
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||
pub struct IdRange {
|
||||
pub min: NodeId,
|
||||
pub max: NodeId,
|
||||
}
|
||||
|
||||
impl IdRange {
|
||||
pub fn max() -> IdRange {
|
||||
IdRange {
|
||||
min: NodeId::MAX,
|
||||
max: NodeId::from_u32(0),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn empty(&self) -> bool {
|
||||
self.min >= self.max
|
||||
}
|
||||
|
||||
pub fn contains(&self, id: NodeId) -> bool {
|
||||
id >= self.min && id < self.max
|
||||
}
|
||||
|
||||
pub fn add(&mut self, id: NodeId) {
|
||||
self.min = cmp::min(self.min, id);
|
||||
self.max = cmp::max(self.max, NodeId::from_u32(id.as_u32() + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub struct IdRangeComputingVisitor<'a, 'hir: 'a> {
|
||||
result: IdRange,
|
||||
map: &'a map::Map<'hir>,
|
||||
}
|
||||
|
||||
impl<'a, 'hir> IdRangeComputingVisitor<'a, 'hir> {
|
||||
pub fn new(map: &'a map::Map<'hir>) -> IdRangeComputingVisitor<'a, 'hir> {
|
||||
IdRangeComputingVisitor { result: IdRange::max(), map: map }
|
||||
}
|
||||
|
||||
pub fn result(&self) -> IdRange {
|
||||
self.result
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'hir> Visitor<'hir> for IdRangeComputingVisitor<'a, 'hir> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'hir> {
|
||||
NestedVisitorMap::OnlyBodies(&self.map)
|
||||
}
|
||||
|
||||
fn visit_id(&mut self, id: NodeId) {
|
||||
self.result.add(id);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ use syntax_pos::{MultiSpan, Span};
|
||||
use errors::{Applicability, DiagnosticBuilder, DiagnosticId};
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::hir::intravisit::{self, Visitor};
|
||||
|
||||
use dataflow::{DataFlowContext, BitwiseOperator, DataFlowOperator, KillFrom};
|
||||
|
||||
@ -157,12 +156,6 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc
|
||||
where F: FnOnce(&mut BorrowckCtxt<'a, 'tcx>) -> &'c cfg::CFG
|
||||
{
|
||||
// Check the body of fn items.
|
||||
let tcx = this.tcx;
|
||||
let id_range = {
|
||||
let mut visitor = intravisit::IdRangeComputingVisitor::new(&tcx.hir());
|
||||
visitor.visit_body(this.body);
|
||||
visitor.result()
|
||||
};
|
||||
let (all_loans, move_data) =
|
||||
gather_loans::gather_loans_in_fn(this, body_id);
|
||||
|
||||
@ -184,7 +177,6 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc
|
||||
Some(this.body),
|
||||
cfg,
|
||||
LoanDataFlowOperator,
|
||||
id_range,
|
||||
all_loans.len());
|
||||
for (loan_idx, loan) in all_loans.iter().enumerate() {
|
||||
loan_dfcx.add_gen(loan.gen_scope.item_local_id(), loan_idx);
|
||||
@ -198,7 +190,6 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc
|
||||
let flowed_moves = move_data::FlowedMoveData::new(move_data,
|
||||
this,
|
||||
cfg,
|
||||
id_range,
|
||||
this.body);
|
||||
|
||||
Some(AnalysisData { all_loans,
|
||||
|
@ -15,7 +15,6 @@ use std::rc::Rc;
|
||||
use std::usize;
|
||||
use syntax_pos::Span;
|
||||
use rustc::hir;
|
||||
use rustc::hir::intravisit::IdRange;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct MoveData<'tcx> {
|
||||
@ -559,7 +558,6 @@ impl<'a, 'tcx> FlowedMoveData<'a, 'tcx> {
|
||||
pub fn new(move_data: MoveData<'tcx>,
|
||||
bccx: &BorrowckCtxt<'a, 'tcx>,
|
||||
cfg: &cfg::CFG,
|
||||
id_range: IdRange,
|
||||
body: &hir::Body)
|
||||
-> FlowedMoveData<'a, 'tcx> {
|
||||
let tcx = bccx.tcx;
|
||||
@ -570,7 +568,6 @@ impl<'a, 'tcx> FlowedMoveData<'a, 'tcx> {
|
||||
Some(body),
|
||||
cfg,
|
||||
MoveDataFlowOperator,
|
||||
id_range,
|
||||
move_data.moves.borrow().len());
|
||||
let mut dfcx_assign =
|
||||
DataFlowContext::new(tcx,
|
||||
@ -578,7 +575,6 @@ impl<'a, 'tcx> FlowedMoveData<'a, 'tcx> {
|
||||
Some(body),
|
||||
cfg,
|
||||
AssignDataFlowOperator,
|
||||
id_range,
|
||||
move_data.var_assignments.borrow().len());
|
||||
|
||||
move_data.add_gen_kills(bccx,
|
||||
|
@ -15,7 +15,7 @@ use rustc_data_structures::graph::implementation::OUTGOING;
|
||||
|
||||
use rustc::util::nodemap::FxHashMap;
|
||||
use rustc::hir;
|
||||
use rustc::hir::intravisit::{self, IdRange};
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::hir::print as pprust;
|
||||
|
||||
|
||||
@ -230,16 +230,15 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
||||
body: Option<&hir::Body>,
|
||||
cfg: &cfg::CFG,
|
||||
oper: O,
|
||||
id_range: IdRange,
|
||||
bits_per_id: usize) -> DataFlowContext<'a, 'tcx, O> {
|
||||
let usize_bits = mem::size_of::<usize>() * 8;
|
||||
let words_per_id = (bits_per_id + usize_bits - 1) / usize_bits;
|
||||
let num_nodes = cfg.graph.all_nodes().len();
|
||||
|
||||
debug!("DataFlowContext::new(analysis_name: {}, id_range={:?}, \
|
||||
debug!("DataFlowContext::new(analysis_name: {}, \
|
||||
bits_per_id={}, words_per_id={}) \
|
||||
num_nodes: {}",
|
||||
analysis_name, id_range, bits_per_id, words_per_id,
|
||||
analysis_name, bits_per_id, words_per_id,
|
||||
num_nodes);
|
||||
|
||||
let entry = if oper.initial_value() { usize::MAX } else {0};
|
||||
|
Loading…
x
Reference in New Issue
Block a user