From b865e30b49f3f0fb914ab82d152fae0f608ed540 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Wed, 9 Dec 2015 15:56:49 -0500 Subject: [PATCH] Upgrade rust to rustc 1.6.0-nightly (462ec0576 2015-12-09) --- Cargo.toml | 2 +- src/eq_op.rs | 1 - src/len_zero.rs | 4 ++-- src/lib.rs | 4 ++-- src/map_clone.rs | 1 - src/shadow.rs | 10 +++++----- tests/compile-fail/shadow.rs | 16 ++++++++-------- tests/compile-fail/transmute.rs | 1 - 8 files changed, 18 insertions(+), 21 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4ae56d791f5..c70e43ed78d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clippy" -version = "0.0.29" +version = "0.0.30" authors = [ "Manish Goregaokar ", "Andre Bogus ", diff --git a/src/eq_op.rs b/src/eq_op.rs index 1d2146537c9..7636267bcd8 100644 --- a/src/eq_op.rs +++ b/src/eq_op.rs @@ -66,7 +66,6 @@ fn is_path_equal(left : &Path, right : &Path) -> bool { // we have to be explicit about hygiene left.global == right.global && over(&left.segments, &right.segments, |l, r| l.identifier.name == r.identifier.name - && l.identifier.ctxt == r.identifier.ctxt && l.parameters == r.parameters) } diff --git a/src/len_zero.rs b/src/len_zero.rs index 9ac4ab1e0e0..c501ceb66fa 100644 --- a/src/len_zero.rs +++ b/src/len_zero.rs @@ -50,7 +50,7 @@ impl LateLintPass for LenZero { } } -fn check_trait_items(cx: &LateContext, item: &Item, trait_items: &[P]) { +fn check_trait_items(cx: &LateContext, item: &Item, trait_items: &[TraitItem]) { fn is_named_self(item: &TraitItem, name: &str) -> bool { item.name.as_str() == name && if let MethodTraitItem(ref sig, _) = item.node { is_self_sig(sig) } else { false } @@ -69,7 +69,7 @@ fn check_trait_items(cx: &LateContext, item: &Item, trait_items: &[P] } } -fn check_impl_items(cx: &LateContext, item: &Item, impl_items: &[P]) { +fn check_impl_items(cx: &LateContext, item: &Item, impl_items: &[ImplItem]) { fn is_named_self(item: &ImplItem, name: &str) -> bool { item.name.as_str() == name && if let ImplItemKind::Method(ref sig, _) = item.node { is_self_sig(sig) } else { false } diff --git a/src/lib.rs b/src/lib.rs index be0db936e6b..03e0cbea19c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ #![feature(plugin_registrar, box_syntax)] -#![feature(rustc_private, core, collections)] +#![feature(rustc_private, collections)] #![feature(num_bits_bytes, iter_arith)] #![allow(unknown_lints)] @@ -68,7 +68,7 @@ pub mod escape; pub mod misc_early; mod reexport { - pub use syntax::ast::{Name, Ident, NodeId}; + pub use syntax::ast::{Name, NodeId}; } #[plugin_registrar] diff --git a/src/map_clone.rs b/src/map_clone.rs index ba561fbb167..d9719df0b6f 100644 --- a/src/map_clone.rs +++ b/src/map_clone.rs @@ -1,6 +1,5 @@ use rustc::lint::*; use rustc_front::hir::*; -use syntax::ast::Ident; use utils::{CLONE_PATH, OPTION_PATH}; use utils::{is_adjusted, match_path, match_trait_method, match_type, snippet, span_help_and_lint}; use utils::{walk_ptrs_ty, walk_ptrs_ty_depth}; diff --git a/src/shadow.rs b/src/shadow.rs index 60197fcf9df..b9f60e0e01a 100644 --- a/src/shadow.rs +++ b/src/shadow.rs @@ -39,7 +39,7 @@ fn check_fn(cx: &LateContext, decl: &FnDecl, block: &Block) { let mut bindings = Vec::new(); for arg in &decl.inputs { if let PatIdent(_, ident, _) = arg.pat.node { - bindings.push((ident.node.name, ident.span)) + bindings.push((ident.node.unhygienic_name, ident.span)) } } check_block(cx, block, &mut bindings); @@ -85,7 +85,7 @@ fn check_pat(cx: &LateContext, pat: &Pat, init: &Option<&Expr>, span: Span, //TODO: match more stuff / destructuring match pat.node { PatIdent(_, ref ident, ref inner) => { - let name = ident.node.name; + let name = ident.node.unhygienic_name; if is_binding(cx, pat) { let mut new_binding = true; for tup in bindings.iter_mut() { @@ -266,7 +266,7 @@ fn is_self_shadow(name: Name, expr: &Expr) -> bool { fn path_eq_name(name: Name, path: &Path) -> bool { !path.global && path.segments.len() == 1 && - path.segments[0].identifier.name == name + path.segments[0].identifier.unhygienic_name == name } struct ContainsSelf { @@ -275,8 +275,8 @@ struct ContainsSelf { } impl<'v> Visitor<'v> for ContainsSelf { - fn visit_name(&mut self, _: Span, name: Name) { - if self.name == name { + fn visit_ident(&mut self, _: Span, ident: Ident) { + if self.name == ident.unhygienic_name { self.result = true; } } diff --git a/tests/compile-fail/shadow.rs b/tests/compile-fail/shadow.rs index d70f26ed090..0a52a9829ae 100644 --- a/tests/compile-fail/shadow.rs +++ b/tests/compile-fail/shadow.rs @@ -10,15 +10,15 @@ fn first(x: (isize, isize)) -> isize { x.0 } fn main() { let mut x = 1; - let x = &mut x; //~ERROR: x is shadowed by itself in &mut x - let x = { x }; //~ERROR: x is shadowed by itself in { x } - let x = (&*x); //~ERROR: x is shadowed by itself in &*x - let x = { *x + 1 }; //~ERROR: x is shadowed by { *x + 1 } which reuses - let x = id(x); //~ERROR: x is shadowed by id(x) which reuses - let x = (1, x); //~ERROR: x is shadowed by (1, x) which reuses - let x = first(x); //~ERROR: x is shadowed by first(x) which reuses + let x = &mut x; //~ERROR x is shadowed by itself in &mut x + let x = { x }; //~ERROR x is shadowed by itself in { x } + let x = (&*x); //~ERROR x is shadowed by itself in &*x + let x = { *x + 1 }; //~ERROR x is shadowed by { *x + 1 } which reuses + let x = id(x); //~ERROR x is shadowed by id(x) which reuses + let x = (1, x); //~ERROR x is shadowed by (1, x) which reuses + let x = first(x); //~ERROR x is shadowed by first(x) which reuses let y = 1; - let x = y; //~ERROR: x is shadowed by y + let x = y; //~ERROR x is shadowed by y let o = Some(1u8); diff --git a/tests/compile-fail/transmute.rs b/tests/compile-fail/transmute.rs index 0a2d09d9431..94dd3a18549 100644 --- a/tests/compile-fail/transmute.rs +++ b/tests/compile-fail/transmute.rs @@ -1,4 +1,3 @@ -#![feature(core)] #![feature(plugin)] #![plugin(clippy)] #![deny(useless_transmute)]