aboutsummaryrefslogtreecommitdiffstats
path: root/components/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'components/plugins')
-rw-r--r--components/plugins/heap_size.rs1
-rw-r--r--components/plugins/jstraceable.rs1
-rw-r--r--components/plugins/lints/inheritance_integrity.rs5
-rw-r--r--components/plugins/lints/privatize.rs5
-rw-r--r--components/plugins/lints/unrooted_must_root.rs10
-rw-r--r--components/plugins/utils.rs5
6 files changed, 16 insertions, 11 deletions
diff --git a/components/plugins/heap_size.rs b/components/plugins/heap_size.rs
index 3ab1fc814a1..c2dc2d2566c 100644
--- a/components/plugins/heap_size.rs
+++ b/components/plugins/heap_size.rs
@@ -24,6 +24,7 @@ use syntax::ptr::P;
pub fn expand_heap_size(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem,
item: &Annotatable, push: &mut FnMut(Annotatable)) {
let trait_def = TraitDef {
+ is_unsafe: false,
span: span,
attributes: Vec::new(),
path: ty::Path::new(vec!("util", "mem", "HeapSizeOf")),
diff --git a/components/plugins/jstraceable.rs b/components/plugins/jstraceable.rs
index 2dfd4305c9d..5ff252053d8 100644
--- a/components/plugins/jstraceable.rs
+++ b/components/plugins/jstraceable.rs
@@ -38,6 +38,7 @@ pub fn expand_dom_struct(cx: &mut ExtCtxt, sp: Span, _: &MetaItem, anno: Annotat
pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: &Annotatable,
push: &mut FnMut(Annotatable)) {
let trait_def = TraitDef {
+ is_unsafe: false,
span: span,
attributes: Vec::new(),
path: ty::Path::new(vec!("dom","bindings","trace","JSTraceable")),
diff --git a/components/plugins/lints/inheritance_integrity.rs b/components/plugins/lints/inheritance_integrity.rs
index ab6dc2d1a1b..70fbed0c016 100644
--- a/components/plugins/lints/inheritance_integrity.rs
+++ b/components/plugins/lints/inheritance_integrity.rs
@@ -4,7 +4,8 @@
use rustc::lint::{Context, LintPass, LintArray, Level};
use rustc::middle::def;
-use syntax::{ast, ast_util};
+use rustc::middle::def_id::DefId;
+use syntax::ast;
use utils::match_lang_ty;
@@ -26,7 +27,7 @@ impl LintPass for InheritancePass {
_gen: &ast::Generics, id: ast::NodeId) {
// Lints are run post expansion, so it's fine to use
// #[_dom_struct_marker] here without also checking for #[dom_struct]
- if cx.tcx.has_attr(ast_util::local_def(id), "_dom_struct_marker") {
+ if cx.tcx.has_attr(DefId::local(id), "_dom_struct_marker") {
// Find the reflector, if any
let reflector_span = def.fields.iter().enumerate()
.find(|&(ctr, f)| {
diff --git a/components/plugins/lints/privatize.rs b/components/plugins/lints/privatize.rs
index 7ef92eeaf30..a4a684b68ab 100644
--- a/components/plugins/lints/privatize.rs
+++ b/components/plugins/lints/privatize.rs
@@ -3,9 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use rustc::lint::{Context, LintPass, LintArray};
+use rustc::middle::def_id::DefId;
+use syntax::ast;
use syntax::ast::Public;
use syntax::attr::AttrMetaMethods;
-use syntax::{ast, ast_util};
declare_lint!(PRIVATIZE, Deny,
"Allows to enforce private fields for struct definitions");
@@ -27,7 +28,7 @@ impl LintPass for PrivatizePass {
_i: ast::Ident,
_gen: &ast::Generics,
id: ast::NodeId) {
- if cx.tcx.has_attr(ast_util::local_def(id), "privatize") {
+ if cx.tcx.has_attr(DefId::local(id), "privatize") {
for field in &def.fields {
match field.node {
ast::StructField_ { kind: ast::NamedField(ident, visibility), .. } if visibility == Public => {
diff --git a/components/plugins/lints/unrooted_must_root.rs b/components/plugins/lints/unrooted_must_root.rs
index 9a94919556a..f20d5a43f2a 100644
--- a/components/plugins/lints/unrooted_must_root.rs
+++ b/components/plugins/lints/unrooted_must_root.rs
@@ -120,14 +120,14 @@ impl LintPass for UnrootedPass {
fn check_fn(&mut self, cx: &Context, kind: visit::FnKind, decl: &ast::FnDecl,
block: &ast::Block, _span: codemap::Span, id: ast::NodeId) {
match kind {
- visit::FkItemFn(i, _, _, _, _, _) |
- visit::FkMethod(i, _, _) if i.name.as_str() == "new"
- || i.name.as_str() == "new_inherited"
- || i.name.as_str() == "new_initialized" => {
+ visit::FnKind::ItemFn(i, _, _, _, _, _) |
+ visit::FnKind::Method(i, _, _) if i.name.as_str() == "new"
+ || i.name.as_str() == "new_inherited"
+ || i.name.as_str() == "new_initialized" => {
self.in_new_function = true;
return;
},
- visit::FkItemFn(_, _, style, _, _, _) => match style {
+ visit::FnKind::ItemFn(_, _, style, _, _, _) => match style {
ast::Unsafety::Unsafe => return,
_ => ()
},
diff --git a/components/plugins/utils.rs b/components/plugins/utils.rs
index e26cc4bc7cd..580cfe9efc5 100644
--- a/components/plugins/utils.rs
+++ b/components/plugins/utils.rs
@@ -5,6 +5,7 @@
use rustc::ast_map;
use rustc::lint::Context;
use rustc::middle::def;
+use rustc::middle::def_id::DefId;
use syntax::ast;
use syntax::ast::{TyPath, Path, AngleBracketedParameters, PathSegment, Ty};
@@ -52,7 +53,7 @@ pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool {
match_lang_did(cx, def_id, value)
}
-pub fn match_lang_did(cx: &Context, did: ast::DefId, value: &str) -> bool {
+pub fn match_lang_did(cx: &Context, did: DefId, value: &str) -> bool {
cx.tcx.get_attrs(did).iter().any(|attr| {
match attr.node.value.node {
ast::MetaNameValue(ref name, ref val) if &**name == "servo_lang" => {
@@ -96,7 +97,7 @@ pub fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool {
/// check if a DefId's path matches the given absolute type path
/// usage e.g. with
/// `match_def_path(cx, id, &["core", "option", "Option"])`
-pub fn match_def_path(cx: &Context, def_id: ast::DefId, path: &[&str]) -> bool {
+pub fn match_def_path(cx: &Context, 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))
}