From c86a5ccd2ee3165690386faad06ffdb4f4b59187 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 22 Jan 2016 17:54:44 +0530 Subject: [PATCH] Upgrade Rust to rustc 1.8.0-nightly (18b851bc5 2016-01-22) fixes #573 --- Cargo.toml | 2 +- src/bit_mask.rs | 4 ++-- src/consts.rs | 4 ++-- src/escape.rs | 4 ++-- src/lifetimes.rs | 6 +++--- src/loops.rs | 4 ++-- src/no_effect.rs | 6 +++--- src/ptr_arg.rs | 4 ++-- src/shadow.rs | 4 ++-- src/utils.rs | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4cdc1bd9b..36b95ebe3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clippy" -version = "0.0.36" +version = "0.0.37" authors = [ "Manish Goregaokar ", "Andre Bogus ", diff --git a/src/bit_mask.rs b/src/bit_mask.rs index 0e98f5a93..6c6d277e2 100644 --- a/src/bit_mask.rs +++ b/src/bit_mask.rs @@ -1,6 +1,6 @@ use rustc::lint::*; 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::util::is_comparison_binop; use syntax::codemap::Span; @@ -274,7 +274,7 @@ fn fetch_int_literal(cx: &LateContext, lit: &Expr) -> Option { // borrowing. let def_map = cx.tcx.def_map.borrow(); 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, } } diff --git a/src/consts.rs b/src/consts.rs index 7b0229477..34f7e924d 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -3,7 +3,7 @@ use rustc::lint::LateContext; use rustc::middle::const_eval::lookup_const_by_id; use rustc::middle::def::PathResolution; -use rustc::middle::def::Def::*; +use rustc::middle::def::Def; use rustc_front::hir::*; use syntax::ptr::P; use std::char; @@ -481,7 +481,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { fn fetch_path(&mut self, e: &Expr) -> Option { if let Some(lcx) = self.lcx { 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); } // separate if lets to avoid double borrowing the def_map diff --git a/src/escape.rs b/src/escape.rs index 70151054e..32dbbb992 100644 --- a/src/escape.rs +++ b/src/escape.rs @@ -1,7 +1,7 @@ use rustc::lint::*; +use rustc::front::map::Node::NodeStmt; use rustc_front::hir::*; use rustc_front::intravisit as visit; -use rustc::front::map::Node; use rustc::middle::ty; use rustc::middle::ty::adjustment::AutoAdjustment; use rustc::middle::expr_use_visitor::*; @@ -91,7 +91,7 @@ impl<'a, 'tcx: 'a> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> { return; } if let Categorization::Rvalue(..) = cmt.cat { - if let Some(Node::NodeStmt(st)) = self.cx + if let Some(NodeStmt(st)) = self.cx .tcx .map .find(self.cx.tcx.map.get_parent_node(cmt.id)) { diff --git a/src/lifetimes.rs b/src/lifetimes.rs index 83da3d864..b83ac390e 100644 --- a/src/lifetimes.rs +++ b/src/lifetimes.rs @@ -3,7 +3,7 @@ use reexport::*; use rustc::lint::*; use syntax::codemap::Span; 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 utils::{in_external_macro, span_lint}; @@ -206,13 +206,13 @@ impl<'v, 't> RefVisitor<'v, 't> { if params.lifetimes.is_empty() { if let Some(def) = self.cx.tcx.def_map.borrow().get(&ty.id).map(|r| r.full_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); for _ in type_scheme.generics.regions.as_slice() { self.record(&None); } } - DefTrait(def_id) => { + Def::Trait(def_id) => { let trait_def = self.cx.tcx.trait_defs.borrow()[&def_id]; for _ in &trait_def.generics.regions { self.record(&None); diff --git a/src/loops.rs b/src/loops.rs index 614b56174..699e6e525 100644 --- a/src/loops.rs +++ b/src/loops.rs @@ -3,7 +3,7 @@ use rustc_front::hir::*; use reexport::*; use rustc_front::intravisit::{Visitor, walk_expr, walk_block, walk_decl}; use rustc::middle::ty; -use rustc::middle::def::DefLocal; +use rustc::middle::def::Def; use consts::{constant_simple, Constant}; use rustc::front::map::Node::NodeBlock; 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 { 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); } } diff --git a/src/no_effect.rs b/src/no_effect.rs index 3b2d91fc7..075b9b628 100644 --- a/src/no_effect.rs +++ b/src/no_effect.rs @@ -1,5 +1,5 @@ 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::{Stmt, StmtSemi}; @@ -36,8 +36,8 @@ fn has_no_effect(cx: &LateContext, expr: &Expr) -> bool { ExprCall(ref callee, ref args) => { let def = cx.tcx.def_map.borrow().get(&callee.id).map(|d| d.full_def()); match def { - Some(DefStruct(..)) | - Some(DefVariant(..)) => args.iter().all(|arg| has_no_effect(cx, arg)), + Some(Def::Struct(..)) | + Some(Def::Variant(..)) => args.iter().all(|arg| has_no_effect(cx, arg)), _ => false, } } diff --git a/src/ptr_arg.rs b/src/ptr_arg.rs index 2e1e16cf2..75ce96f63 100644 --- a/src/ptr_arg.rs +++ b/src/ptr_arg.rs @@ -4,8 +4,8 @@ use rustc::lint::*; use rustc_front::hir::*; +use rustc::front::map::NodeItem; use rustc::middle::ty; -use rustc::front::map::Node; use utils::{span_lint, match_type}; use utils::{STRING_PATH, VEC_PATH}; @@ -42,7 +42,7 @@ impl LateLintPass for PtrArg { fn check_impl_item(&mut self, cx: &LateContext, item: &ImplItem) { 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 { return; // ignore trait impls } diff --git a/src/shadow.rs b/src/shadow.rs index 2d3e423ea..1c445f42b 100644 --- a/src/shadow.rs +++ b/src/shadow.rs @@ -5,7 +5,7 @@ use syntax::codemap::Span; use rustc_front::intravisit::{Visitor, FnKind}; 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}; @@ -103,7 +103,7 @@ fn check_decl(cx: &LateContext, decl: &Decl, bindings: &mut Vec<(Name, Span)>) { fn is_binding(cx: &LateContext, pat: &Pat) -> bool { 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, } } diff --git a/src/utils.rs b/src/utils.rs index 446303f8b..323f0592d 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -235,7 +235,7 @@ pub fn get_trait_def_id(cx: &LateContext, path: &[&str]) -> Option { }; match def { - cstore::DlDef(def::DefTrait(trait_id)) => Some(trait_id), + cstore::DlDef(def::Def::Trait(trait_id)) => Some(trait_id), _ => None, } }