Update to latest nightly
This commit is contained in:
@@ -70,8 +70,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||||||
too_large_for_stack: self.too_large_for_stack,
|
too_large_for_stack: self.too_large_for_stack,
|
||||||
};
|
};
|
||||||
|
|
||||||
let region_maps = &cx.tcx.region_maps(fn_def_id);
|
let region_scope_tree = &cx.tcx.region_scope_tree(fn_def_id);
|
||||||
ExprUseVisitor::new(&mut v, cx.tcx, cx.param_env, region_maps, cx.tables).consume_body(body);
|
ExprUseVisitor::new(&mut v, cx.tcx, cx.param_env, region_scope_tree, cx.tables).consume_body(body);
|
||||||
|
|
||||||
for node in v.set {
|
for node in v.set {
|
||||||
span_lint(
|
span_lint(
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use rustc::hir::intravisit::{Visitor, walk_expr, walk_block, walk_decl, walk_pat
|
|||||||
use rustc::hir::map::Node::{NodeBlock, NodeExpr, NodeStmt};
|
use rustc::hir::map::Node::{NodeBlock, NodeExpr, NodeStmt};
|
||||||
use rustc::lint::*;
|
use rustc::lint::*;
|
||||||
use rustc::middle::const_val::ConstVal;
|
use rustc::middle::const_val::ConstVal;
|
||||||
use rustc::middle::region::CodeExtent;
|
use rustc::middle::region;
|
||||||
use rustc::ty::{self, Ty};
|
use rustc::ty::{self, Ty};
|
||||||
use rustc::ty::subst::{Subst, Substs};
|
use rustc::ty::subst::{Subst, Substs};
|
||||||
use rustc_const_eval::ConstContext;
|
use rustc_const_eval::ConstContext;
|
||||||
@@ -621,9 +621,9 @@ fn check_for_loop_range<'a, 'tcx>(
|
|||||||
if let Some(indexed_extent) = indexed_extent {
|
if let Some(indexed_extent) = indexed_extent {
|
||||||
let parent_id = cx.tcx.hir.get_parent(expr.id);
|
let parent_id = cx.tcx.hir.get_parent(expr.id);
|
||||||
let parent_def_id = cx.tcx.hir.local_def_id(parent_id);
|
let parent_def_id = cx.tcx.hir.local_def_id(parent_id);
|
||||||
let region_maps = cx.tcx.region_maps(parent_def_id);
|
let region_scope_tree = cx.tcx.region_scope_tree(parent_def_id);
|
||||||
let pat_extent = region_maps.var_scope(pat.hir_id.local_id);
|
let pat_extent = region_scope_tree.var_scope(pat.hir_id.local_id);
|
||||||
if region_maps.is_subscope_of(indexed_extent, pat_extent) {
|
if region_scope_tree.is_subscope_of(indexed_extent, pat_extent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1034,7 +1034,7 @@ struct VarVisitor<'a, 'tcx: 'a> {
|
|||||||
/// var name to look for as index
|
/// var name to look for as index
|
||||||
var: DefId,
|
var: DefId,
|
||||||
/// indexed variables, the extend is `None` for global
|
/// indexed variables, the extend is `None` for global
|
||||||
indexed: HashMap<Name, Option<CodeExtent>>,
|
indexed: HashMap<Name, Option<region::Scope>>,
|
||||||
/// Any names that are used outside an index operation.
|
/// Any names that are used outside an index operation.
|
||||||
/// Used to detect things like `&mut vec` used together with `vec[i]`
|
/// Used to detect things like `&mut vec` used together with `vec[i]`
|
||||||
referenced: HashSet<Name>,
|
referenced: HashSet<Name>,
|
||||||
@@ -1068,7 +1068,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
|
|||||||
|
|
||||||
let parent_id = self.cx.tcx.hir.get_parent(expr.id);
|
let parent_id = self.cx.tcx.hir.get_parent(expr.id);
|
||||||
let parent_def_id = self.cx.tcx.hir.local_def_id(parent_id);
|
let parent_def_id = self.cx.tcx.hir.local_def_id(parent_id);
|
||||||
let extent = self.cx.tcx.region_maps(parent_def_id).var_scope(hir_id.local_id);
|
let extent = self.cx.tcx.region_scope_tree(parent_def_id).var_scope(hir_id.local_id);
|
||||||
self.indexed.insert(seqvar.segments[0].name, Some(extent));
|
self.indexed.insert(seqvar.segments[0].name, Some(extent));
|
||||||
return; // no need to walk further
|
return; // no need to walk further
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
|
|||||||
..
|
..
|
||||||
} = {
|
} = {
|
||||||
let mut ctx = MovedVariablesCtxt::new(cx);
|
let mut ctx = MovedVariablesCtxt::new(cx);
|
||||||
let region_maps = &cx.tcx.region_maps(fn_def_id);
|
let region_scope_tree = &cx.tcx.region_scope_tree(fn_def_id);
|
||||||
euv::ExprUseVisitor::new(&mut ctx, cx.tcx, cx.param_env, region_maps, cx.tables).consume_body(body);
|
euv::ExprUseVisitor::new(&mut ctx, cx.tcx, cx.param_env, region_scope_tree, cx.tables).consume_body(body);
|
||||||
ctx
|
ctx
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user