aboutsummaryrefslogtreecommitdiffstats
path: root/components/plugins
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-09-21 13:12:01 +0530
committerMs2ger <Ms2ger@gmail.com>2015-09-23 14:44:59 +0200
commit3c969b346a02928abeea2796a0ec92a072f70b6e (patch)
treefbf7b015edf85032dd2327dde6867da2c568b594 /components/plugins
parent8f1469eb08a437bcc6cfb510334be2b6430b4a8f (diff)
downloadservo-3c969b346a02928abeea2796a0ec92a072f70b6e.tar.gz
servo-3c969b346a02928abeea2796a0ec92a072f70b6e.zip
Upgrade rust to f93ab64d4a1a7ee91759a1594ab2a426b6cc657e/rustc-1.5.0-dev.
Diffstat (limited to 'components/plugins')
-rw-r--r--components/plugins/Cargo.toml2
-rw-r--r--components/plugins/lib.rs17
-rw-r--r--components/plugins/lints/ban.rs8
-rw-r--r--components/plugins/lints/inheritance_integrity.rs11
-rw-r--r--components/plugins/lints/privatize.rs14
-rw-r--r--components/plugins/lints/str_to_string.rs12
-rw-r--r--components/plugins/lints/transmute_type.rs12
-rw-r--r--components/plugins/lints/unrooted_must_root.rs59
-rw-r--r--components/plugins/utils.rs28
9 files changed, 87 insertions, 76 deletions
diff --git a/components/plugins/Cargo.toml b/components/plugins/Cargo.toml
index 0162a1f5516..9e317316984 100644
--- a/components/plugins/Cargo.toml
+++ b/components/plugins/Cargo.toml
@@ -9,7 +9,7 @@ path = "lib.rs"
plugin = true
[dependencies.tenacious]
-git = "https://github.com/servo/rust-tenacious"
+git = "https://github.com/Manishearth/rust-tenacious"
[dependencies.clippy]
git = "https://github.com/Manishearth/rust-clippy"
diff --git a/components/plugins/lib.rs b/components/plugins/lib.rs
index 250fa500a5e..a9fbb4ad280 100644
--- a/components/plugins/lib.rs
+++ b/components/plugins/lib.rs
@@ -20,11 +20,12 @@ extern crate syntax;
#[macro_use]
extern crate rustc;
+extern crate rustc_front;
+
extern crate tenacious;
#[cfg(feature = "clippy")]
extern crate clippy;
-use rustc::lint::LintPassObject;
use rustc::plugin::Registry;
use syntax::ext::base::*;
use syntax::feature_gate::AttributeType::Whitelisted;
@@ -50,12 +51,12 @@ pub fn plugin_registrar(reg: &mut Registry) {
reg.register_syntax_extension(intern("derive_HeapSizeOf"), MultiDecorator(box heap_size::expand_heap_size));
reg.register_macro("to_lower", casing::expand_lower);
reg.register_macro("to_upper", casing::expand_upper);
- reg.register_lint_pass(box lints::transmute_type::TransmutePass as LintPassObject);
- reg.register_lint_pass(box lints::unrooted_must_root::UnrootedPass::new() as LintPassObject);
- reg.register_lint_pass(box lints::privatize::PrivatizePass as LintPassObject);
- reg.register_lint_pass(box lints::inheritance_integrity::InheritancePass as LintPassObject);
- reg.register_lint_pass(box lints::ban::BanPass as LintPassObject);
- reg.register_lint_pass(box tenacious::TenaciousPass as LintPassObject);
+ reg.register_late_lint_pass(box lints::transmute_type::TransmutePass);
+ reg.register_late_lint_pass(box lints::unrooted_must_root::UnrootedPass::new());
+ reg.register_late_lint_pass(box lints::privatize::PrivatizePass);
+ reg.register_late_lint_pass(box lints::inheritance_integrity::InheritancePass);
+ reg.register_early_lint_pass(box lints::ban::BanPass);
+ reg.register_late_lint_pass(box tenacious::TenaciousPass);
reg.register_attribute("must_root".to_string(), Whitelisted);
reg.register_attribute("servo_lang".to_string(), Whitelisted);
reg.register_attribute("allow_unrooted_interior".to_string(), Whitelisted);
@@ -68,5 +69,5 @@ fn register_clippy(reg: &mut Registry) {
}
#[cfg(not(feature = "clippy"))]
fn register_clippy(reg: &mut Registry) {
- reg.register_lint_pass(box lints::str_to_string::StrToStringPass as LintPassObject);
+ reg.register_late_lint_pass(box lints::str_to_string::StrToStringPass);
}
diff --git a/components/plugins/lints/ban.rs b/components/plugins/lints/ban.rs
index 70b81a70dd9..02037a5d76a 100644
--- a/components/plugins/lints/ban.rs
+++ b/components/plugins/lints/ban.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::lint::{Context, LintPass, LintArray};
-use syntax::ast;
+use rustc::lint::{EarlyContext, LintPass, LintArray, EarlyLintPass, LintContext};
+use syntax::ast::Ty;
use utils::match_ty_unwrap;
declare_lint!(BANNED_TYPE, Deny,
@@ -21,8 +21,10 @@ impl LintPass for BanPass {
fn get_lints(&self) -> LintArray {
lint_array!(BANNED_TYPE)
}
+}
- fn check_ty(&mut self, cx: &Context, ty: &ast::Ty) {
+impl EarlyLintPass for BanPass {
+ fn check_ty(&mut self, cx: &EarlyContext, ty: &Ty) {
if match_ty_unwrap(ty, &["std", "cell", "Cell"])
.and_then(|t| t.get(0))
.and_then(|t| match_ty_unwrap(&**t, &["dom", "bindings", "js", "JS"]))
diff --git a/components/plugins/lints/inheritance_integrity.rs b/components/plugins/lints/inheritance_integrity.rs
index ac9c965e7b2..e1845b0a786 100644
--- a/components/plugins/lints/inheritance_integrity.rs
+++ b/components/plugins/lints/inheritance_integrity.rs
@@ -2,9 +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::lint::{Context, LintPass, LintArray, Level};
+use rustc::lint::{LateContext, LintPass, LintArray, Level, LateLintPass, LintContext};
use rustc::middle::def;
use rustc::middle::def_id::DefId;
+use rustc_front::hir;
use syntax::ast;
use utils::match_lang_ty;
@@ -21,9 +22,11 @@ impl LintPass for InheritancePass {
fn get_lints(&self) -> LintArray {
lint_array!(INHERITANCE_INTEGRITY)
}
+}
- fn check_struct_def(&mut self, cx: &Context, def: &ast::StructDef, _i: ast::Ident,
- _gen: &ast::Generics, id: ast::NodeId) {
+impl LateLintPass for InheritancePass {
+ fn check_struct_def(&mut self, cx: &LateContext, def: &hir::StructDef, _i: ast::Ident,
+ _gen: &hir::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(DefId::local(id), "_dom_struct_marker") {
@@ -43,7 +46,7 @@ impl LintPass for InheritancePass {
.map(|(_, f)| f.span);
// Find all #[dom_struct] fields
let dom_spans: Vec<_> = def.fields.iter().enumerate().filter_map(|(ctr, f)| {
- if let ast::TyPath(..) = f.node.ty.node {
+ if let hir::TyPath(..) = f.node.ty.node {
if let Some(&def::PathResolution { base_def: def::DefTy(def_id, _), .. }) =
cx.tcx.def_map.borrow().get(&f.node.ty.id) {
if cx.tcx.has_attr(def_id, "_dom_struct_marker") {
diff --git a/components/plugins/lints/privatize.rs b/components/plugins/lints/privatize.rs
index a4a684b68ab..07e5b903553 100644
--- a/components/plugins/lints/privatize.rs
+++ b/components/plugins/lints/privatize.rs
@@ -2,10 +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::lint::{Context, LintPass, LintArray};
+use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext};
use rustc::middle::def_id::DefId;
+use rustc_front::hir;
use syntax::ast;
-use syntax::ast::Public;
use syntax::attr::AttrMetaMethods;
declare_lint!(PRIVATIZE, Deny,
@@ -21,17 +21,19 @@ impl LintPass for PrivatizePass {
fn get_lints(&self) -> LintArray {
lint_array!(PRIVATIZE)
}
+}
+impl LateLintPass for PrivatizePass {
fn check_struct_def(&mut self,
- cx: &Context,
- def: &ast::StructDef,
+ cx: &LateContext,
+ def: &hir::StructDef,
_i: ast::Ident,
- _gen: &ast::Generics,
+ _gen: &hir::Generics,
id: ast::NodeId) {
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 => {
+ hir::StructField_ { kind: hir::NamedField(ident, visibility), .. } if visibility == hir::Public => {
cx.span_lint(PRIVATIZE, field.span,
&format!("Field {} is public where only private fields are allowed",
ident.name));
diff --git a/components/plugins/lints/str_to_string.rs b/components/plugins/lints/str_to_string.rs
index 431a161e999..80a16841323 100644
--- a/components/plugins/lints/str_to_string.rs
+++ b/components/plugins/lints/str_to_string.rs
@@ -2,9 +2,9 @@
* 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::lint::{Context, LintPass, LintArray};
+use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext};
use rustc::middle::ty;
-use syntax::ast;
+use rustc_front::hir;
declare_lint!(STR_TO_STRING, Deny,
"Warn when a String could use to_owned() instead of to_string()");
@@ -18,10 +18,12 @@ impl LintPass for StrToStringPass {
fn get_lints(&self) -> LintArray {
lint_array!(STR_TO_STRING)
}
+}
- fn check_expr(&mut self, cx: &Context, expr: &ast::Expr) {
+impl LateLintPass for StrToStringPass {
+ fn check_expr(&mut self, cx: &LateContext, expr: &hir::Expr) {
match expr.node {
- ast::ExprMethodCall(ref method, _, ref args)
+ hir::ExprMethodCall(ref method, _, ref args)
if method.node.name.as_str() == "to_string"
&& is_str(cx, &*args[0]) => {
cx.span_lint(STR_TO_STRING, expr.span,
@@ -30,7 +32,7 @@ impl LintPass for StrToStringPass {
_ => ()
}
- fn is_str(cx: &Context, expr: &ast::Expr) -> bool {
+ fn is_str(cx: &LateContext, expr: &hir::Expr) -> bool {
fn walk_ty<'t>(ty: ty::Ty<'t>) -> ty::Ty<'t> {
match ty.sty {
ty::TyRef(_, ref tm) | ty::TyRawPtr(ref tm) => walk_ty(tm.ty),
diff --git a/components/plugins/lints/transmute_type.rs b/components/plugins/lints/transmute_type.rs
index 94255e377a7..8e7c2ed8429 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::lint::{Context, LintPass, LintArray};
-use syntax::ast;
+use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext};
+use rustc_front::hir;
use syntax::attr::AttrMetaMethods;
declare_lint!(TRANSMUTE_TYPE_LINT, Allow,
@@ -19,12 +19,14 @@ impl LintPass for TransmutePass {
fn get_lints(&self) -> LintArray {
lint_array!(TRANSMUTE_TYPE_LINT)
}
+}
- fn check_expr(&mut self, cx: &Context, ex: &ast::Expr) {
+impl LateLintPass for TransmutePass {
+ fn check_expr(&mut self, cx: &LateContext, ex: &hir::Expr) {
match ex.node {
- ast::ExprCall(ref expr, ref args) => {
+ hir::ExprCall(ref expr, ref args) => {
match expr.node {
- ast::ExprPath(_, ref path) => {
+ hir::ExprPath(_, ref path) => {
if path.segments.last()
.map_or(false, |ref segment| segment.identifier.name.as_str() == "transmute")
&& args.len() == 1 {
diff --git a/components/plugins/lints/unrooted_must_root.rs b/components/plugins/lints/unrooted_must_root.rs
index f20d5a43f2a..04dc7dce3a5 100644
--- a/components/plugins/lints/unrooted_must_root.rs
+++ b/components/plugins/lints/unrooted_must_root.rs
@@ -2,12 +2,13 @@
* 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::ast_map;
-use rustc::lint::{Context, LintPass, LintArray};
+use rustc::front::map as ast_map;
+use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext};
use rustc::middle::astconv_util::ast_ty_to_prim_ty;
use rustc::middle::ty;
+use rustc_front::{hir, visit};
use syntax::attr::AttrMetaMethods;
-use syntax::{ast, codemap, visit};
+use syntax::{ast, codemap};
use utils::{match_def_path, unsafe_context};
declare_lint!(UNROOTED_MUST_ROOT, Deny,
@@ -43,7 +44,7 @@ impl UnrootedPass {
}
/// Checks if a type is unrooted or contains any owned unrooted types
-fn is_unrooted_ty(cx: &Context, ty: &ty::TyS, in_new_function: bool) -> bool {
+fn is_unrooted_ty(cx: &LateContext, ty: &ty::TyS, in_new_function: bool) -> bool {
let mut ret = false;
ty.maybe_walk(|t| {
match t.sty {
@@ -76,12 +77,15 @@ impl LintPass for UnrootedPass {
fn get_lints(&self) -> LintArray {
lint_array!(UNROOTED_MUST_ROOT)
}
+}
+
+impl LateLintPass for UnrootedPass {
/// All structs containing #[must_root] types must be #[must_root] themselves
fn check_struct_def(&mut self,
- cx: &Context,
- def: &ast::StructDef,
+ cx: &LateContext,
+ def: &hir::StructDef,
_i: ast::Ident,
- _gen: &ast::Generics,
+ _gen: &hir::Generics,
id: ast::NodeId) {
let item = match cx.tcx.map.get(id) {
ast_map::Node::NodeItem(item) => item,
@@ -97,11 +101,11 @@ impl LintPass for UnrootedPass {
}
}
/// All enums containing #[must_root] types must be #[must_root] themselves
- fn check_variant(&mut self, cx: &Context, var: &ast::Variant, _gen: &ast::Generics) {
+ fn check_variant(&mut self, cx: &LateContext, var: &hir::Variant, _gen: &hir::Generics) {
let ref map = cx.tcx.map;
if map.expect_item(map.get_parent(var.node.id)).attrs.iter().all(|a| !a.check_name("must_root")) {
match var.node.kind {
- ast::TupleVariantKind(ref vec) => {
+ hir::TupleVariantKind(ref vec) => {
for ty in vec {
ast_ty_to_prim_ty(cx.tcx, &*ty.ty).map(|t| {
if is_unrooted_ty(cx, t, false) {
@@ -117,8 +121,8 @@ impl LintPass for UnrootedPass {
}
}
/// Function arguments that are #[must_root] types are not allowed
- fn check_fn(&mut self, cx: &Context, kind: visit::FnKind, decl: &ast::FnDecl,
- block: &ast::Block, _span: codemap::Span, id: ast::NodeId) {
+ fn check_fn(&mut self, cx: &LateContext, kind: visit::FnKind, decl: &hir::FnDecl,
+ block: &hir::Block, _span: codemap::Span, id: ast::NodeId) {
match kind {
visit::FnKind::ItemFn(i, _, _, _, _, _) |
visit::FnKind::Method(i, _, _) if i.name.as_str() == "new"
@@ -128,7 +132,7 @@ impl LintPass for UnrootedPass {
return;
},
visit::FnKind::ItemFn(_, _, style, _, _, _) => match style {
- ast::Unsafety::Unsafe => return,
+ hir::Unsafety::Unsafe => return,
_ => ()
},
_ => ()
@@ -140,7 +144,7 @@ impl LintPass for UnrootedPass {
}
match block.rules {
- ast::DefaultBlock => {
+ hir::DefaultBlock => {
for arg in &decl.inputs {
ast_ty_to_prim_ty(cx.tcx, &*arg.ty).map(|t| {
if is_unrooted_ty(cx, t, false) {
@@ -154,8 +158,8 @@ impl LintPass for UnrootedPass {
}
/// Trait casts from #[must_root] types are not allowed
- fn check_expr(&mut self, cx: &Context, expr: &ast::Expr) {
- fn require_rooted(cx: &Context, in_new_function: bool, subexpr: &ast::Expr) {
+ fn check_expr(&mut self, cx: &LateContext, expr: &hir::Expr) {
+ fn require_rooted(cx: &LateContext, in_new_function: bool, subexpr: &hir::Expr) {
let ty = cx.tcx.expr_ty(&*subexpr);
if is_unrooted_ty(cx, ty, in_new_function) {
cx.span_lint(UNROOTED_MUST_ROOT,
@@ -165,7 +169,7 @@ impl LintPass for UnrootedPass {
};
match expr.node {
- ast::ExprCast(ref subexpr, _) => require_rooted(cx, self.in_new_function, &*subexpr),
+ hir::ExprCast(ref subexpr, _) => require_rooted(cx, self.in_new_function, &*subexpr),
_ => {
// TODO(pcwalton): Check generics with a whitelist of allowed generics.
}
@@ -176,11 +180,11 @@ impl LintPass for UnrootedPass {
// Catches `let` statements and assignments which store a #[must_root] value
// Expressions which return out of blocks eventually end up in a `let` or assignment
// statement or a function return (which will be caught when it is used elsewhere)
- fn check_stmt(&mut self, cx: &Context, s: &ast::Stmt) {
+ fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
match s.node {
- ast::StmtDecl(_, id) |
- ast::StmtExpr(_, id) |
- ast::StmtSemi(_, id) if unsafe_context(&cx.tcx.map, id) => {
+ hir::StmtDecl(_, id) |
+ hir::StmtExpr(_, id) |
+ hir::StmtSemi(_, id) if unsafe_context(&cx.tcx.map, id) => {
return
},
_ => ()
@@ -188,26 +192,21 @@ impl LintPass for UnrootedPass {
let expr = match s.node {
// Catch a `let` binding
- ast::StmtDecl(ref decl, _) => match decl.node {
- ast::DeclLocal(ref loc) => match loc.init {
+ hir::StmtDecl(ref decl, _) => match decl.node {
+ hir::DeclLocal(ref loc) => match loc.init {
Some(ref e) => &**e,
_ => return
},
_ => return
},
- ast::StmtExpr(ref expr, _) => match expr.node {
+ hir::StmtExpr(ref expr, _) => match expr.node {
// This catches deferred `let` statements
- ast::ExprAssign(_, ref e) |
+ hir::ExprAssign(_, ref e) |
// Match statements allow you to bind onto the variable later in an arm
// We need not check arms individually since enum/struct fields are already
// linted in `check_struct_def` and `check_variant`
// (so there is no way of destructuring out a `#[must_root]` field)
- ast::ExprMatch(ref e, _, _) => &**e,
- // These are able to bind local variables, but are desugared into
- // loops and matches pre-lint so should not be encountered
- ast::ExprForLoop(..) => unreachable!(),
- ast::ExprIfLet(..) => unreachable!(),
- ast::ExprWhileLet(..) => unreachable!(),
+ hir::ExprMatch(ref e, _, _) => &**e,
_ => return
},
_ => return
diff --git a/components/plugins/utils.rs b/components/plugins/utils.rs
index 3780f1932a2..7576437a939 100644
--- a/components/plugins/utils.rs
+++ b/components/plugins/utils.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::ast_map;
-use rustc::lint::Context;
+use rustc::front::map as ast_map;
+use rustc::lint::LateContext;
use rustc::middle::def;
use rustc::middle::def_id::DefId;
+use rustc_front::hir;
use syntax::ast;
-use syntax::ast::{TyPath, Path, AngleBracketedParameters, PathSegment, Ty};
use syntax::attr::mark_used;
use syntax::ptr::P;
@@ -15,16 +15,16 @@ use syntax::ptr::P;
/// Matches a type with a provided string, and returns its type parameters if successful
///
/// Try not to use this for types defined in crates you own, use match_lang_ty instead (for lint passes)
-pub fn match_ty_unwrap<'a>(ty: &'a Ty, segments: &[&str]) -> Option<&'a [P<Ty>]> {
+pub fn match_ty_unwrap<'a>(ty: &'a ast::Ty, segments: &[&str]) -> Option<&'a [P<ast::Ty>]> {
match ty.node {
- TyPath(_, Path { segments: ref seg, .. }) => {
- // So ast::Path isn't the full path, just the tokens that were provided.
+ ast::TyPath(_, ast::Path { segments: ref seg, .. }) => {
+ // So hir::Path isn't the full path, just the tokens that were provided.
// I could muck around with the maps and find the full path
// however the more efficient way is to simply reverse the iterators and zip them
// which will compare them in reverse until one of them runs out of segments
if seg.iter().rev().zip(segments.iter().rev()).all(|(a, b)| a.identifier.name.as_str() == *b) {
match seg.last() {
- Some(&PathSegment { parameters: AngleBracketedParameters(ref a), .. }) => {
+ Some(&ast::PathSegment { parameters: ast::AngleBracketedParameters(ref a), .. }) => {
Some(&a.types)
}
_ => None
@@ -38,9 +38,9 @@ pub fn match_ty_unwrap<'a>(ty: &'a Ty, segments: &[&str]) -> Option<&'a [P<Ty>]>
}
/// Checks if a type has a #[servo_lang = "str"] attribute
-pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool {
+pub fn match_lang_ty(cx: &LateContext, ty: &hir::Ty, value: &str) -> bool {
match ty.node {
- TyPath(..) => {},
+ hir::TyPath(..) => {},
_ => return false,
}
@@ -52,7 +52,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: DefId, value: &str) -> bool {
+pub fn match_lang_did(cx: &LateContext, 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" => {
@@ -75,14 +75,14 @@ pub fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool {
match map.find(map.get_parent(id)) {
Some(ast_map::NodeImplItem(itm)) => {
match itm.node {
- ast::MethodImplItem(ref sig, _) => sig.unsafety == ast::Unsafety::Unsafe,
+ hir::MethodImplItem(ref sig, _) => sig.unsafety == hir::Unsafety::Unsafe,
_ => false
}
},
Some(ast_map::NodeItem(itm)) => {
match itm.node {
- ast::ItemFn(_, style, _, _, _, _) => match style {
- ast::Unsafety::Unsafe => true,
+ hir::ItemFn(_, style, _, _, _, _) => match style {
+ hir::Unsafety::Unsafe => true,
_ => false,
},
_ => false,
@@ -96,7 +96,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: DefId, path: &[&str]) -> bool {
+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))
}