impl<'a, 'tcx> Visitor<'tcx> for IrMaps<'a, 'tcx> {
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
- NestedVisitorMap::OnlyBodies(&self.tcx.hir)
+ NestedVisitorMap::OnlyBodies(&self.tcx.hir())
}
fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx hir::FnDecl,
}
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
- tcx.hir.krate().visit_all_item_likes(&mut IrMaps::new(tcx).as_deep_visitor());
+ tcx.hir().krate().visit_all_item_likes(&mut IrMaps::new(tcx).as_deep_visitor());
tcx.sess.abort_if_errors();
}
// Don't run unused pass for #[derive()]
if let FnKind::Method(..) = fk {
- let parent = ir.tcx.hir.get_parent(id);
- if let Some(Node::Item(i)) = ir.tcx.hir.find(parent) {
+ let parent = ir.tcx.hir().get_parent(id);
+ if let Some(Node::Item(i)) = ir.tcx.hir().find(parent) {
if i.attrs.iter().any(|a| a.check_name("automatically_derived")) {
return;
}
debug!("creating fn_maps: {:?}", &fn_maps as *const IrMaps<'_, '_>);
- let body = ir.tcx.hir.body(body_id);
+ let body = ir.tcx.hir().body(body_id);
for arg in &body.arguments {
arg.pat.each_binding(|_bm, hir_id, _x, ident| {
call_caps.extend(freevars.iter().filter_map(|fv| {
if let Def::Local(rv) = fv.def {
let fv_ln = ir.add_live_node(FreeVarNode(fv.span));
- let var_hid = ir.tcx.hir.node_to_hir_id(rv);
+ let var_hid = ir.tcx.hir().node_to_hir_id(rv);
Some(CaptureInfo { ln: fv_ln, var_hid })
} else {
None
/// 65 bits of data into 32; in the uncommon cases, it expands the 65 bits
/// in 96.
///
- /// More compact representations are possible -- e.g. use only 2 bits per
+ /// More compact representations are possible -- e.g., use only 2 bits per
/// packed `RWU` and make the secondary table a HashMap that maps from
/// indices to `RWU`s -- but this one strikes a good balance between size
/// and speed.
// effectively a return---this only occurs in `for` loops,
// where the body is really a closure.
- debug!("compute: using id for body, {}", self.ir.tcx.hir.node_to_pretty_string(body.id));
+ debug!("compute: using id for body, {}", self.ir.tcx.hir().node_to_pretty_string(body.id));
let exit_ln = self.s.exit_ln;
fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode)
-> LiveNode {
- debug!("propagate_through_expr: {}", self.ir.tcx.hir.node_to_pretty_string(expr.id));
+ debug!("propagate_through_expr: {}", self.ir.tcx.hir().node_to_pretty_string(expr.id));
match expr.node {
// Interesting cases with control flow or which gen/kill
hir::ExprKind::Closure(.., blk_id, _, _) => {
debug!("{} is an ExprKind::Closure",
- self.ir.tcx.hir.node_to_pretty_string(expr.id));
+ self.ir.tcx.hir().node_to_pretty_string(expr.id));
// The next-node for a break is the successor of the entire
// loop. The next-node for a continue is the top of this loop.
let ln = self.live_node(hir_id, span);
if acc != 0 {
self.init_from_succ(ln, succ);
- let var_hid = self.ir.tcx.hir.node_to_hir_id(nid);
+ let var_hid = self.ir.tcx.hir().node_to_hir_id(nid);
let var = self.variable(var_hid, span);
self.acc(ln, var, acc);
}
}
}
debug!("propagate_through_loop: using id for loop body {} {}",
- expr.id, self.ir.tcx.hir.node_to_pretty_string(body.id));
+ expr.id, self.ir.tcx.hir().node_to_pretty_string(body.id));
let break_ln = succ;
let cont_ln = ln;
// mutable, then check for a reassignment to flag the mutability
// as being used.
let ln = self.live_node(expr.hir_id, expr.span);
- let var_hid = self.ir.tcx.hir.node_to_hir_id(nid);
+ let var_hid = self.ir.tcx.hir().node_to_hir_id(nid);
let var = self.variable(var_hid, expr.span);
self.warn_about_dead_assign(expr.span, expr.hir_id, ln, var);
}
let sp = ident.span;
let var = self.variable(hir_id, sp);
// Ignore unused self.
- if ident.name != keywords::SelfValue.name() {
+ if ident.name != keywords::SelfLower.name() {
if !self.warn_about_unused(sp, hir_id, entry_ln, var) {
if self.live_on_entry(entry_ln, var).is_none() {
self.report_dead_assign(hir_id, sp, var, true);