Merge pull request #2153 from rust-lang-nursery/rustup
rustup to rustc 1.22.0-nightly (b7960878b
2017-10-18)
This commit is contained in:
commit
ed90843e97
@ -71,7 +71,7 @@ fn check_fn(
|
||||
};
|
||||
|
||||
let region_scope_tree = &cx.tcx.region_scope_tree(fn_def_id);
|
||||
ExprUseVisitor::new(&mut v, cx.tcx, cx.param_env, region_scope_tree, cx.tables).consume_body(body);
|
||||
ExprUseVisitor::new(&mut v, cx.tcx, cx.param_env, region_scope_tree, cx.tables, None).consume_body(body);
|
||||
|
||||
for node in v.set {
|
||||
span_lint(
|
||||
|
@ -1390,7 +1390,7 @@ fn check_for_mutation(cx: &LateContext, body: &Expr, bound_ids: &[Option<NodeId>
|
||||
let mut delegate = MutateDelegate { node_id_low: bound_ids[0], node_id_high: bound_ids[1], span_low: None, span_high: None };
|
||||
let def_id = def_id::DefId::local(body.hir_id.owner);
|
||||
let region_scope_tree = &cx.tcx.region_scope_tree(def_id);
|
||||
ExprUseVisitor::new(&mut delegate, cx.tcx, cx.param_env, region_scope_tree, cx.tables).walk_expr(body);
|
||||
ExprUseVisitor::new(&mut delegate, cx.tcx, cx.param_env, region_scope_tree, cx.tables, None).walk_expr(body);
|
||||
delegate.mutation_span()
|
||||
}
|
||||
|
||||
|
@ -821,18 +821,6 @@ fn check_general_case(
|
||||
or_has_args: bool,
|
||||
span: Span,
|
||||
) {
|
||||
// don't lint for constant values
|
||||
// FIXME: can we `expect` here instead of match?
|
||||
let promotable = cx.tcx
|
||||
.rvalue_promotable_to_static
|
||||
.borrow()
|
||||
.get(&arg.id)
|
||||
.cloned()
|
||||
.unwrap_or(true);
|
||||
if promotable {
|
||||
return;
|
||||
}
|
||||
|
||||
// (path, fn_has_argument, methods, suffix)
|
||||
let know_types: &[(&[_], _, &[_], _)] = &[
|
||||
(&paths::BTREEMAP_ENTRY, false, &["or_insert"], "with"),
|
||||
@ -841,6 +829,21 @@ fn check_general_case(
|
||||
(&paths::RESULT, true, &["or", "unwrap_or"], "else"),
|
||||
];
|
||||
|
||||
// early check if the name is one we care about
|
||||
if know_types.iter().all(|k| !k.2.contains(&name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// don't lint for constant values
|
||||
// FIXME: can we `expect` here instead of match?
|
||||
let owner_def = cx.tcx.hir.get_parent_did(arg.id);
|
||||
let promotable = cx.tcx
|
||||
.rvalue_promotable_map(owner_def)
|
||||
[&arg.hir_id.local_id];
|
||||
if promotable {
|
||||
return;
|
||||
}
|
||||
|
||||
let self_ty = cx.tables.expr_ty(self_expr);
|
||||
|
||||
let (fn_has_arguments, poss, suffix) = if let Some(&(_, fn_has_arguments, poss, suffix)) =
|
||||
|
@ -108,7 +108,7 @@ fn check_fn(
|
||||
} = {
|
||||
let mut ctx = MovedVariablesCtxt::new(cx);
|
||||
let region_scope_tree = &cx.tcx.region_scope_tree(fn_def_id);
|
||||
euv::ExprUseVisitor::new(&mut ctx, cx.tcx, cx.param_env, region_scope_tree, cx.tables).consume_body(body);
|
||||
euv::ExprUseVisitor::new(&mut ctx, cx.tcx, cx.param_env, region_scope_tree, cx.tables, None).consume_body(body);
|
||||
ctx
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user