Merge pull request #2640 from mikerite/fix_compilation_20180406

Fix compilation for nightly 2018-04-06
This commit is contained in:
Oliver Schneider 2018-04-07 09:42:26 +02:00 committed by GitHub
commit a863ba16e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 18 additions and 18 deletions

View file

@ -132,7 +132,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
if_chain! { if_chain! {
if let NestedMetaItemKind::MetaItem(ref mi) = item.node; if let NestedMetaItemKind::MetaItem(ref mi) = item.node;
if let MetaItemKind::NameValue(ref lit) = mi.node; if let MetaItemKind::NameValue(ref lit) = mi.node;
if mi.name() == "since"; if mi.ident.name == "since";
then { then {
check_semver(cx, item.span, lit); check_semver(cx, item.span, lit);
} }
@ -328,7 +328,7 @@ fn check_semver(cx: &LateContext, span: Span, lit: &Lit) {
fn is_word(nmi: &NestedMetaItem, expected: &str) -> bool { fn is_word(nmi: &NestedMetaItem, expected: &str) -> bool {
if let NestedMetaItemKind::MetaItem(ref mi) = nmi.node { if let NestedMetaItemKind::MetaItem(ref mi) = nmi.node {
mi.is_word() && mi.name() == expected mi.is_word() && mi.ident.name == expected
} else { } else {
false false
} }

View file

@ -56,7 +56,7 @@ impl StaticConst {
span_lint_and_then( span_lint_and_then(
cx, cx,
CONST_STATIC_LIFETIME, CONST_STATIC_LIFETIME,
lifetime.span, lifetime.ident.span,
"Constants have by default a `'static` lifetime", "Constants have by default a `'static` lifetime",
|db| { |db| {
db.span_suggestion(ty.span, "consider removing `'static`", sugg); db.span_suggestion(ty.span, "consider removing `'static`", sugg);

View file

@ -119,7 +119,7 @@ impl LintPass for EnumVariantNames {
} }
fn var2str(var: &Variant) -> InternedString { fn var2str(var: &Variant) -> InternedString {
var.node.name.name.as_str() var.node.ident.name.as_str()
} }
/// Returns the number of chars that match from the start /// Returns the number of chars that match from the start

View file

@ -195,7 +195,7 @@ impl EarlyLintPass for MiscEarly {
span_lint( span_lint(
cx, cx,
BUILTIN_TYPE_SHADOW, BUILTIN_TYPE_SHADOW,
ty.span, ty.ident.span,
&format!("This generic shadows the built-in type `{}`", name), &format!("This generic shadows the built-in type `{}`", name),
); );
} }
@ -209,7 +209,7 @@ impl EarlyLintPass for MiscEarly {
let type_name = npat.segments let type_name = npat.segments
.last() .last()
.expect("A path must have at least one segment") .expect("A path must have at least one segment")
.identifier .ident
.name; .name;
for field in pfields { for field in pfields {
@ -267,8 +267,8 @@ impl EarlyLintPass for MiscEarly {
let mut registered_names: HashMap<String, Span> = HashMap::new(); let mut registered_names: HashMap<String, Span> = HashMap::new();
for arg in &decl.inputs { for arg in &decl.inputs {
if let PatKind::Ident(_, sp_ident, None) = arg.pat.node { if let PatKind::Ident(_, ident, None) = arg.pat.node {
let arg_name = sp_ident.node.to_string(); let arg_name = ident.name.to_string();
if arg_name.starts_with('_') { if arg_name.starts_with('_') {
if let Some(correspondence) = registered_names.get(&arg_name[1..]) { if let Some(correspondence) = registered_names.get(&arg_name[1..]) {
@ -328,13 +328,13 @@ impl EarlyLintPass for MiscEarly {
if let StmtKind::Local(ref local) = w[0].node; if let StmtKind::Local(ref local) = w[0].node;
if let Option::Some(ref t) = local.init; if let Option::Some(ref t) = local.init;
if let ExprKind::Closure(_, _, _, _, _) = t.node; if let ExprKind::Closure(_, _, _, _, _) = t.node;
if let PatKind::Ident(_, sp_ident, _) = local.pat.node; if let PatKind::Ident(_, ident, _) = local.pat.node;
if let StmtKind::Semi(ref second) = w[1].node; if let StmtKind::Semi(ref second) = w[1].node;
if let ExprKind::Assign(_, ref call) = second.node; if let ExprKind::Assign(_, ref call) = second.node;
if let ExprKind::Call(ref closure, _) = call.node; if let ExprKind::Call(ref closure, _) = call.node;
if let ExprKind::Path(_, ref path) = closure.node; if let ExprKind::Path(_, ref path) = closure.node;
then { then {
if sp_ident.node == (&path.segments[0]).identifier { if ident == (&path.segments[0]).ident {
span_lint( span_lint(
cx, cx,
REDUNDANT_CLOSURE_CALL, REDUNDANT_CLOSURE_CALL,

View file

@ -104,7 +104,7 @@ struct SimilarNamesNameVisitor<'a: 'b, 'tcx: 'a, 'b>(&'b mut SimilarNamesLocalVi
impl<'a, 'tcx: 'a, 'b> Visitor<'tcx> for SimilarNamesNameVisitor<'a, 'tcx, 'b> { impl<'a, 'tcx: 'a, 'b> Visitor<'tcx> for SimilarNamesNameVisitor<'a, 'tcx, 'b> {
fn visit_pat(&mut self, pat: &'tcx Pat) { fn visit_pat(&mut self, pat: &'tcx Pat) {
match pat.node { match pat.node {
PatKind::Ident(_, id, _) => self.check_name(id.span, id.node.name), PatKind::Ident(_, ident, _) => self.check_name(ident.span, ident.name),
PatKind::Struct(_, ref fields, _) => for field in fields { PatKind::Struct(_, ref fields, _) => for field in fields {
if !field.node.is_shorthand { if !field.node.is_shorthand {
self.visit_pat(&field.node.pat); self.visit_pat(&field.node.pat);

View file

@ -1,6 +1,6 @@
use rustc::lint::*; use rustc::lint::*;
use syntax::ast; use syntax::ast;
use syntax::codemap::{Span, Spanned}; use syntax::codemap::Span;
use syntax::visit::FnKind; use syntax::visit::FnKind;
use utils::{in_external_macro, in_macro, match_path_ast, snippet_opt, span_lint_and_then, span_note_and_lint}; use utils::{in_external_macro, in_macro, match_path_ast, snippet_opt, span_lint_and_then, span_note_and_lint};
@ -112,9 +112,9 @@ impl ReturnPass {
if local.ty.is_none(); if local.ty.is_none();
if !local.attrs.iter().any(attr_is_cfg); if !local.attrs.iter().any(attr_is_cfg);
if let Some(ref initexpr) = local.init; if let Some(ref initexpr) = local.init;
if let ast::PatKind::Ident(_, Spanned { node: id, .. }, _) = local.pat.node; if let ast::PatKind::Ident(_, ident, _) = local.pat.node;
if let ast::ExprKind::Path(_, ref path) = retexpr.node; if let ast::ExprKind::Path(_, ref path) = retexpr.node;
if match_path_ast(path, &[&id.name.as_str()]); if match_path_ast(path, &[&ident.name.as_str()]);
if !in_external_macro(cx, initexpr.span); if !in_external_macro(cx, initexpr.span);
then { then {
span_note_and_lint(cx, span_note_and_lint(cx,

View file

@ -49,7 +49,7 @@ fn check_use_tree(use_tree: &UseTree, cx: &EarlyContext, span: &Span) {
.segments .segments
.last() .last()
.expect("use paths cannot be empty") .expect("use paths cannot be empty")
.identifier; .ident;
unsafe_to_safe_check(old_name, new_name, cx, span); unsafe_to_safe_check(old_name, new_name, cx, span);
} }
UseTreeKind::Simple(None) | UseTreeKind::Simple(None) |

View file

@ -471,7 +471,7 @@ fn has_attr(attrs: &[Attribute]) -> bool {
attrs.iter().any(|attr| { attrs.iter().any(|attr| {
attr.check_name("clippy") && attr.meta_item_list().map_or(false, |list| { attr.check_name("clippy") && attr.meta_item_list().map_or(false, |list| {
list.len() == 1 && match list[0].node { list.len() == 1 && match list[0].node {
ast::NestedMetaItemKind::MetaItem(ref it) => it.name == "author", ast::NestedMetaItemKind::MetaItem(ref it) => it.ident.name == "author",
ast::NestedMetaItemKind::Literal(_) => false, ast::NestedMetaItemKind::Literal(_) => false,
} }
}) })

View file

@ -13,7 +13,7 @@ pub fn file_from_args(
args: &[codemap::Spanned<ast::NestedMetaItemKind>], args: &[codemap::Spanned<ast::NestedMetaItemKind>],
) -> Result<Option<path::PathBuf>, (&'static str, codemap::Span)> { ) -> Result<Option<path::PathBuf>, (&'static str, codemap::Span)> {
for arg in args.iter().filter_map(|a| a.meta_item()) { for arg in args.iter().filter_map(|a| a.meta_item()) {
if arg.name() == "conf_file" { if arg.ident.name == "conf_file" {
return match arg.node { return match arg.node {
ast::MetaItemKind::Word | ast::MetaItemKind::List(_) => { ast::MetaItemKind::Word | ast::MetaItemKind::List(_) => {
Err(("`conf_file` must be a named value", arg.span)) Err(("`conf_file` must be a named value", arg.span))

View file

@ -237,7 +237,7 @@ pub fn match_path_ast(path: &ast::Path, segments: &[&str]) -> bool {
.iter() .iter()
.rev() .rev()
.zip(segments.iter().rev()) .zip(segments.iter().rev())
.all(|(a, b)| a.identifier.name == *b) .all(|(a, b)| a.ident.name == *b)
} }
/// Get the definition associated to a path. /// Get the definition associated to a path.