Upgrade Rust to rustc 1.8.0-nightly (18b851bc5 2016-01-22)

fixes #573
This commit is contained in:
Manish Goregaokar 2016-01-22 17:54:44 +05:30
parent 28b0437354
commit c86a5ccd2e
10 changed files with 20 additions and 20 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "clippy" name = "clippy"
version = "0.0.36" version = "0.0.37"
authors = [ authors = [
"Manish Goregaokar <manishsmail@gmail.com>", "Manish Goregaokar <manishsmail@gmail.com>",
"Andre Bogus <bogusandre@gmail.com>", "Andre Bogus <bogusandre@gmail.com>",

View File

@ -1,6 +1,6 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::middle::const_eval::lookup_const_by_id; use rustc::middle::const_eval::lookup_const_by_id;
use rustc::middle::def::*; use rustc::middle::def::{Def, PathResolution};
use rustc_front::hir::*; use rustc_front::hir::*;
use rustc_front::util::is_comparison_binop; use rustc_front::util::is_comparison_binop;
use syntax::codemap::Span; use syntax::codemap::Span;
@ -274,7 +274,7 @@ fn fetch_int_literal(cx: &LateContext, lit: &Expr) -> Option<u64> {
// borrowing. // borrowing.
let def_map = cx.tcx.def_map.borrow(); let def_map = cx.tcx.def_map.borrow();
match def_map.get(&lit.id) { match def_map.get(&lit.id) {
Some(&PathResolution { base_def: DefConst(def_id), ..}) => Some(def_id), Some(&PathResolution { base_def: Def::Const(def_id), ..}) => Some(def_id),
_ => None, _ => None,
} }
} }

View File

@ -3,7 +3,7 @@
use rustc::lint::LateContext; use rustc::lint::LateContext;
use rustc::middle::const_eval::lookup_const_by_id; use rustc::middle::const_eval::lookup_const_by_id;
use rustc::middle::def::PathResolution; use rustc::middle::def::PathResolution;
use rustc::middle::def::Def::*; use rustc::middle::def::Def;
use rustc_front::hir::*; use rustc_front::hir::*;
use syntax::ptr::P; use syntax::ptr::P;
use std::char; use std::char;
@ -481,7 +481,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
fn fetch_path(&mut self, e: &Expr) -> Option<Constant> { fn fetch_path(&mut self, e: &Expr) -> Option<Constant> {
if let Some(lcx) = self.lcx { if let Some(lcx) = self.lcx {
let mut maybe_id = None; let mut maybe_id = None;
if let Some(&PathResolution { base_def: DefConst(id), ..}) = lcx.tcx.def_map.borrow().get(&e.id) { if let Some(&PathResolution { base_def: Def::Const(id), ..}) = lcx.tcx.def_map.borrow().get(&e.id) {
maybe_id = Some(id); maybe_id = Some(id);
} }
// separate if lets to avoid double borrowing the def_map // separate if lets to avoid double borrowing the def_map

View File

@ -1,7 +1,7 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::front::map::Node::NodeStmt;
use rustc_front::hir::*; use rustc_front::hir::*;
use rustc_front::intravisit as visit; use rustc_front::intravisit as visit;
use rustc::front::map::Node;
use rustc::middle::ty; use rustc::middle::ty;
use rustc::middle::ty::adjustment::AutoAdjustment; use rustc::middle::ty::adjustment::AutoAdjustment;
use rustc::middle::expr_use_visitor::*; use rustc::middle::expr_use_visitor::*;
@ -91,7 +91,7 @@ impl<'a, 'tcx: 'a> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
return; return;
} }
if let Categorization::Rvalue(..) = cmt.cat { if let Categorization::Rvalue(..) = cmt.cat {
if let Some(Node::NodeStmt(st)) = self.cx if let Some(NodeStmt(st)) = self.cx
.tcx .tcx
.map .map
.find(self.cx.tcx.map.get_parent_node(cmt.id)) { .find(self.cx.tcx.map.get_parent_node(cmt.id)) {

View File

@ -3,7 +3,7 @@ use reexport::*;
use rustc::lint::*; use rustc::lint::*;
use syntax::codemap::Span; use syntax::codemap::Span;
use rustc_front::intravisit::{Visitor, walk_ty, walk_ty_param_bound, walk_fn_decl, walk_generics}; use rustc_front::intravisit::{Visitor, walk_ty, walk_ty_param_bound, walk_fn_decl, walk_generics};
use rustc::middle::def::Def::{DefTy, DefTrait, DefStruct}; use rustc::middle::def::Def;
use std::collections::{HashSet, HashMap}; use std::collections::{HashSet, HashMap};
use utils::{in_external_macro, span_lint}; use utils::{in_external_macro, span_lint};
@ -206,13 +206,13 @@ impl<'v, 't> RefVisitor<'v, 't> {
if params.lifetimes.is_empty() { if params.lifetimes.is_empty() {
if let Some(def) = self.cx.tcx.def_map.borrow().get(&ty.id).map(|r| r.full_def()) { if let Some(def) = self.cx.tcx.def_map.borrow().get(&ty.id).map(|r| r.full_def()) {
match def { match def {
DefTy(def_id, _) | DefStruct(def_id) => { Def::TyAlias(def_id) | Def::Struct(def_id) => {
let type_scheme = self.cx.tcx.lookup_item_type(def_id); let type_scheme = self.cx.tcx.lookup_item_type(def_id);
for _ in type_scheme.generics.regions.as_slice() { for _ in type_scheme.generics.regions.as_slice() {
self.record(&None); self.record(&None);
} }
} }
DefTrait(def_id) => { Def::Trait(def_id) => {
let trait_def = self.cx.tcx.trait_defs.borrow()[&def_id]; let trait_def = self.cx.tcx.trait_defs.borrow()[&def_id];
for _ in &trait_def.generics.regions { for _ in &trait_def.generics.regions {
self.record(&None); self.record(&None);

View File

@ -3,7 +3,7 @@ use rustc_front::hir::*;
use reexport::*; use reexport::*;
use rustc_front::intravisit::{Visitor, walk_expr, walk_block, walk_decl}; use rustc_front::intravisit::{Visitor, walk_expr, walk_block, walk_decl};
use rustc::middle::ty; use rustc::middle::ty;
use rustc::middle::def::DefLocal; use rustc::middle::def::Def;
use consts::{constant_simple, Constant}; use consts::{constant_simple, Constant};
use rustc::front::map::Node::NodeBlock; use rustc::front::map::Node::NodeBlock;
use std::borrow::Cow; use std::borrow::Cow;
@ -768,7 +768,7 @@ impl<'v, 't> Visitor<'v> for InitializeVisitor<'v, 't> {
fn var_def_id(cx: &LateContext, expr: &Expr) -> Option<NodeId> { fn var_def_id(cx: &LateContext, expr: &Expr) -> Option<NodeId> {
if let Some(path_res) = cx.tcx.def_map.borrow().get(&expr.id) { if let Some(path_res) = cx.tcx.def_map.borrow().get(&expr.id) {
if let DefLocal(_, node_id) = path_res.base_def { if let Def::Local(_, node_id) = path_res.base_def {
return Some(node_id); return Some(node_id);
} }
} }

View File

@ -1,5 +1,5 @@
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::middle::def::{DefStruct, DefVariant}; use rustc::middle::def::Def;
use rustc_front::hir::{Expr, ExprCall, ExprLit, ExprPath, ExprStruct}; use rustc_front::hir::{Expr, ExprCall, ExprLit, ExprPath, ExprStruct};
use rustc_front::hir::{Stmt, StmtSemi}; use rustc_front::hir::{Stmt, StmtSemi};
@ -36,8 +36,8 @@ fn has_no_effect(cx: &LateContext, expr: &Expr) -> bool {
ExprCall(ref callee, ref args) => { ExprCall(ref callee, ref args) => {
let def = cx.tcx.def_map.borrow().get(&callee.id).map(|d| d.full_def()); let def = cx.tcx.def_map.borrow().get(&callee.id).map(|d| d.full_def());
match def { match def {
Some(DefStruct(..)) | Some(Def::Struct(..)) |
Some(DefVariant(..)) => args.iter().all(|arg| has_no_effect(cx, arg)), Some(Def::Variant(..)) => args.iter().all(|arg| has_no_effect(cx, arg)),
_ => false, _ => false,
} }
} }

View File

@ -4,8 +4,8 @@
use rustc::lint::*; use rustc::lint::*;
use rustc_front::hir::*; use rustc_front::hir::*;
use rustc::front::map::NodeItem;
use rustc::middle::ty; use rustc::middle::ty;
use rustc::front::map::Node;
use utils::{span_lint, match_type}; use utils::{span_lint, match_type};
use utils::{STRING_PATH, VEC_PATH}; use utils::{STRING_PATH, VEC_PATH};
@ -42,7 +42,7 @@ impl LateLintPass for PtrArg {
fn check_impl_item(&mut self, cx: &LateContext, item: &ImplItem) { fn check_impl_item(&mut self, cx: &LateContext, item: &ImplItem) {
if let ImplItemKind::Method(ref sig, _) = item.node { if let ImplItemKind::Method(ref sig, _) = item.node {
if let Some(Node::NodeItem(it)) = cx.tcx.map.find(cx.tcx.map.get_parent(item.id)) { if let Some(NodeItem(it)) = cx.tcx.map.find(cx.tcx.map.get_parent(item.id)) {
if let ItemImpl(_, _, _, Some(_), _, _) = it.node { if let ItemImpl(_, _, _, Some(_), _, _) = it.node {
return; // ignore trait impls return; // ignore trait impls
} }

View File

@ -5,7 +5,7 @@ use syntax::codemap::Span;
use rustc_front::intravisit::{Visitor, FnKind}; use rustc_front::intravisit::{Visitor, FnKind};
use rustc::lint::*; use rustc::lint::*;
use rustc::middle::def::Def::{DefVariant, DefStruct}; use rustc::middle::def::Def;
use utils::{is_from_for_desugar, in_external_macro, snippet, span_lint, span_note_and_lint, DiagnosticWrapper}; use utils::{is_from_for_desugar, in_external_macro, snippet, span_lint, span_note_and_lint, DiagnosticWrapper};
@ -103,7 +103,7 @@ fn check_decl(cx: &LateContext, decl: &Decl, bindings: &mut Vec<(Name, Span)>) {
fn is_binding(cx: &LateContext, pat: &Pat) -> bool { fn is_binding(cx: &LateContext, pat: &Pat) -> bool {
match cx.tcx.def_map.borrow().get(&pat.id).map(|d| d.full_def()) { match cx.tcx.def_map.borrow().get(&pat.id).map(|d| d.full_def()) {
Some(DefVariant(..)) | Some(DefStruct(..)) => false, Some(Def::Variant(..)) | Some(Def::Struct(..)) => false,
_ => true, _ => true,
} }
} }

View File

@ -235,7 +235,7 @@ pub fn get_trait_def_id(cx: &LateContext, path: &[&str]) -> Option<DefId> {
}; };
match def { match def {
cstore::DlDef(def::DefTrait(trait_id)) => Some(trait_id), cstore::DlDef(def::Def::Trait(trait_id)) => Some(trait_id),
_ => None, _ => None,
} }
} }