diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2016-04-14 02:13:33 +0530 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-04-15 15:28:49 +0530 |
commit | e10c5807683274d52652a853ca0bbf6b71b63aca (patch) | |
tree | c3ff84bc0977e629dd5fb382ab107a6c09e850e8 /components/plugins | |
parent | 7faa3ed9cb87ebfa62554940e916bb7e4d04512b (diff) | |
download | servo-e10c5807683274d52652a853ca0bbf6b71b63aca.tar.gz servo-e10c5807683274d52652a853ca0bbf6b71b63aca.zip |
Rust upgrade to 2016-04-12
Diffstat (limited to 'components/plugins')
-rw-r--r-- | components/plugins/Cargo.toml | 2 | ||||
-rw-r--r-- | components/plugins/lib.rs | 1 | ||||
-rw-r--r-- | components/plugins/lints/inheritance_integrity.rs | 3 | ||||
-rw-r--r-- | components/plugins/lints/privatize.rs | 2 | ||||
-rw-r--r-- | components/plugins/lints/transmute_type.rs | 2 | ||||
-rw-r--r-- | components/plugins/lints/unrooted_must_root.rs | 8 | ||||
-rw-r--r-- | components/plugins/reflector.rs | 6 | ||||
-rw-r--r-- | components/plugins/utils.rs | 25 |
8 files changed, 30 insertions, 19 deletions
diff --git a/components/plugins/Cargo.toml b/components/plugins/Cargo.toml index 9a1820a46db..7e7a3bd20c7 100644 --- a/components/plugins/Cargo.toml +++ b/components/plugins/Cargo.toml @@ -15,7 +15,7 @@ rev = "9dca15de3e8ea266d3e7e868c0f358ed4fa5f195" optional = true [dependencies] -tenacious = "0.1.2" +tenacious = "0.2.0" [features] default = [] diff --git a/components/plugins/lib.rs b/components/plugins/lib.rs index 7e982bcb9e4..a2babd3bfab 100644 --- a/components/plugins/lib.rs +++ b/components/plugins/lib.rs @@ -21,7 +21,6 @@ extern crate clippy; #[macro_use] extern crate rustc; -extern crate rustc_front; extern crate rustc_plugin; #[macro_use] extern crate syntax; diff --git a/components/plugins/lints/inheritance_integrity.rs b/components/plugins/lints/inheritance_integrity.rs index cc186deb0d9..96a93dec809 100644 --- a/components/plugins/lints/inheritance_integrity.rs +++ b/components/plugins/lints/inheritance_integrity.rs @@ -2,9 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use rustc::hir::{self, def}; use rustc::lint::{LateContext, LintPass, LintArray, Level, LateLintPass, LintContext}; -use rustc::middle::def; -use rustc_front::hir; use syntax::ast; use utils::match_lang_ty; diff --git a/components/plugins/lints/privatize.rs b/components/plugins/lints/privatize.rs index e02c5b09212..36d545ddc14 100644 --- a/components/plugins/lints/privatize.rs +++ b/components/plugins/lints/privatize.rs @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use rustc::hir; use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext}; -use rustc_front::hir; use syntax::ast; use syntax::attr::AttrMetaMethods; diff --git a/components/plugins/lints/transmute_type.rs b/components/plugins/lints/transmute_type.rs index 8e7c2ed8429..8f9f4d7ce6b 100644 --- a/components/plugins/lints/transmute_type.rs +++ b/components/plugins/lints/transmute_type.rs @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use rustc::hir; use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext}; -use rustc_front::hir; use syntax::attr::AttrMetaMethods; declare_lint!(TRANSMUTE_TYPE_LINT, Allow, diff --git a/components/plugins/lints/unrooted_must_root.rs b/components/plugins/lints/unrooted_must_root.rs index 56db0f5f9c4..5f9f63a9e4b 100644 --- a/components/plugins/lints/unrooted_must_root.rs +++ b/components/plugins/lints/unrooted_must_root.rs @@ -2,12 +2,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use rustc::front::map as ast_map; +use rustc::hir; +use rustc::hir::intravisit as visit; +use rustc::hir::map as ast_map; +use rustc::hir::pat_util::pat_is_binding; use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext}; -use rustc::middle::pat_util::pat_is_binding; use rustc::ty; -use rustc_front::hir; -use rustc_front::intravisit as visit; use syntax::attr::AttrMetaMethods; use syntax::{ast, codemap}; use utils::{match_def_path, in_derive_expn}; diff --git a/components/plugins/reflector.rs b/components/plugins/reflector.rs index 660fd2a455d..4e6f69ed2d3 100644 --- a/components/plugins/reflector.rs +++ b/components/plugins/reflector.rs @@ -15,10 +15,10 @@ pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable: let struct_name = item.ident; // This path has to be hardcoded, unfortunately, since we can't resolve paths at expansion time match def.fields().iter().find( - |f| match_ty_unwrap(&*f.node.ty, &["dom", "bindings", "reflector", "Reflector"]).is_some()) { + |f| match_ty_unwrap(&*f.ty, &["dom", "bindings", "reflector", "Reflector"]).is_some()) { // If it has a field that is a Reflector, use that Some(f) => { - let field_name = f.node.ident(); + let field_name = f.ident; let impl_item = quote_item!(cx, impl ::dom::bindings::reflector::Reflectable for $struct_name { fn reflector<'a>(&'a self) -> &'a ::dom::bindings::reflector::Reflector { @@ -33,7 +33,7 @@ pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable: }, // Or just call it on the first field (supertype). None => { - let field_name = def.fields()[0].node.ident(); + let field_name = def.fields()[0].ident; let impl_item = quote_item!(cx, impl ::dom::bindings::reflector::Reflectable for $struct_name { fn reflector<'a>(&'a self) -> &'a ::dom::bindings::reflector::Reflector { diff --git a/components/plugins/utils.rs b/components/plugins/utils.rs index 29b09255936..b514e967d5b 100644 --- a/components/plugins/utils.rs +++ b/components/plugins/utils.rs @@ -2,11 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use rustc::front::map as ast_map; +use rustc::hir::def_id::DefId; +use rustc::hir::map as ast_map; +use rustc::hir::{self, def}; use rustc::lint::{LateContext, LintContext}; -use rustc::middle::def; -use rustc::middle::def_id::DefId; -use rustc_front::hir; use syntax::ast; use syntax::attr::mark_used; use syntax::codemap::{ExpnFormat, Span}; @@ -102,8 +101,22 @@ pub fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool { /// usage e.g. with /// `match_def_path(cx, id, &["core", "option", "Option"])` pub fn match_def_path(cx: &LateContext, def_id: DefId, path: &[&str]) -> bool { - cx.tcx.with_path(def_id, |iter| iter.map(|elem| elem.name()) - .zip(path.iter()).all(|(nm, p)| &nm.as_str() == p)) + let krate = &cx.tcx.crate_name(def_id.krate); + if krate != &path[0] { + return false; + } + + let path = &path[1..]; + let other = cx.tcx.def_path(def_id).data; + + if other.len() != path.len() { + return false; + } + + other.into_iter() + .map(|e| e.data) + .zip(path) + .all(|(nm, p)| nm.as_interned_str() == *p) } pub fn in_derive_expn(cx: &LateContext, span: Span) -> bool { |