aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/plugins/lints/inheritance_integrity.rs8
-rw-r--r--components/plugins/lints/privatize.rs2
-rw-r--r--components/plugins/lints/unrooted_must_root.rs18
-rw-r--r--rust-nightly-date2
4 files changed, 16 insertions, 14 deletions
diff --git a/components/plugins/lints/inheritance_integrity.rs b/components/plugins/lints/inheritance_integrity.rs
index 0c70a949c15..28dea9aeb41 100644
--- a/components/plugins/lints/inheritance_integrity.rs
+++ b/components/plugins/lints/inheritance_integrity.rs
@@ -27,7 +27,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InheritancePass {
_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(cx.tcx.map.local_def_id(id), "_dom_struct_marker") {
+ if cx.tcx.has_attr(cx.tcx.hir.local_def_id(id), "_dom_struct_marker") {
// Find the reflector, if any
let reflector_span = def.fields().iter().enumerate()
.find(|&(ctr, f)| {
@@ -66,7 +66,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InheritancePass {
if let Some(sp) = reflector_span {
if dom_spans.len() > 0 {
let mut db = cx.struct_span_lint(INHERITANCE_INTEGRITY,
- cx.tcx.map.expect_item(id).span,
+ cx.tcx.hir.expect_item(id).span,
"This DOM struct has both Reflector \
and bare DOM struct members");
if cx.current_level(INHERITANCE_INTEGRITY) != Level::Allow {
@@ -79,7 +79,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InheritancePass {
// Nor should we have more than one dom struct field
} else if dom_spans.len() > 1 {
let mut db = cx.struct_span_lint(INHERITANCE_INTEGRITY,
- cx.tcx.map.expect_item(id).span,
+ cx.tcx.hir.expect_item(id).span,
"This DOM struct has multiple \
DOM struct members, only one is allowed");
if cx.current_level(INHERITANCE_INTEGRITY) != Level::Allow {
@@ -88,7 +88,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InheritancePass {
}
}
} else if dom_spans.is_empty() {
- cx.span_lint(INHERITANCE_INTEGRITY, cx.tcx.map.expect_item(id).span,
+ cx.span_lint(INHERITANCE_INTEGRITY, cx.tcx.hir.expect_item(id).span,
"This DOM struct has no reflector or parent DOM struct");
}
}
diff --git a/components/plugins/lints/privatize.rs b/components/plugins/lints/privatize.rs
index 0eec1ad1596..e6a44015d81 100644
--- a/components/plugins/lints/privatize.rs
+++ b/components/plugins/lints/privatize.rs
@@ -28,7 +28,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PrivatizePass {
_n: ast::Name,
_gen: &hir::Generics,
id: ast::NodeId) {
- if cx.tcx.has_attr(cx.tcx.map.local_def_id(id), "privatize") {
+ if cx.tcx.has_attr(cx.tcx.hir.local_def_id(id), "privatize") {
for field in def.fields() {
if field.vis == hir::Public {
cx.span_lint(PRIVATIZE, field.span,
diff --git a/components/plugins/lints/unrooted_must_root.rs b/components/plugins/lints/unrooted_must_root.rs
index e16a88fe898..660a0c58781 100644
--- a/components/plugins/lints/unrooted_must_root.rs
+++ b/components/plugins/lints/unrooted_must_root.rs
@@ -56,11 +56,13 @@ fn is_unrooted_ty(cx: &LateContext, ty: &ty::TyS, in_new_function: bool) -> bool
|| match_def_path(cx, did.did, &["std", "collections", "hash", "map", "VacantEntry"]) {
// Structures which are semantically similar to an &ptr.
false
+ } else if did.is_box() && in_new_function {
+ // box in new() is okay
+ false
} else {
true
}
},
- ty::TyBox(..) if in_new_function => false, // box in new() is okay
ty::TyRef(..) => false, // don't recurse down &ptrs
ty::TyRawPtr(..) => false, // don't recurse down *ptrs
ty::TyFnDef(..) | ty::TyFnPtr(_) => false,
@@ -84,13 +86,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnrootedPass {
_n: ast::Name,
_gen: &hir::Generics,
id: ast::NodeId) {
- let item = match cx.tcx.map.get(id) {
+ let item = match cx.tcx.hir.get(id) {
ast_map::Node::NodeItem(item) => item,
- _ => cx.tcx.map.expect_item(cx.tcx.map.get_parent(id)),
+ _ => cx.tcx.hir.expect_item(cx.tcx.hir.get_parent(id)),
};
if item.attrs.iter().all(|a| !a.check_name("must_root")) {
for ref field in def.fields() {
- let def_id = cx.tcx.map.local_def_id(field.id);
+ let def_id = cx.tcx.hir.local_def_id(field.id);
if is_unrooted_ty(cx, cx.tcx.item_type(def_id), false) {
cx.span_lint(UNROOTED_MUST_ROOT, field.span,
"Type must be rooted, use #[must_root] on the struct definition to propagate")
@@ -101,12 +103,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnrootedPass {
/// All enums containing #[must_root] types must be #[must_root] themselves
fn check_variant(&mut self, cx: &LateContext, var: &hir::Variant, _gen: &hir::Generics) {
- let ref map = cx.tcx.map;
+ let ref map = cx.tcx.hir;
if map.expect_item(map.get_parent(var.node.data.id())).attrs.iter().all(|a| !a.check_name("must_root")) {
match var.node.data {
hir::VariantData::Tuple(ref fields, _) => {
for ref field in fields {
- let def_id = cx.tcx.map.local_def_id(field.id);
+ let def_id = cx.tcx.hir.local_def_id(field.id);
if is_unrooted_ty(cx, cx.tcx.item_type(def_id), false) {
cx.span_lint(UNROOTED_MUST_ROOT, field.ty.span,
"Type must be rooted, use #[must_root] on \
@@ -135,7 +137,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnrootedPass {
};
if !in_derive_expn(cx, span) {
- let def_id = cx.tcx.map.local_def_id(id);
+ let def_id = cx.tcx.hir.local_def_id(id);
let ty = cx.tcx.item_type(def_id);
for (arg, ty) in decl.inputs.iter().zip(ty.fn_args().0.iter()) {
@@ -224,6 +226,6 @@ impl<'a, 'b, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'b, 'tcx> {
fn visit_foreign_item(&mut self, _: &'tcx hir::ForeignItem) {}
fn visit_ty(&mut self, _: &'tcx hir::Ty) { }
fn nested_visit_map<'this>(&'this mut self) -> hir::intravisit::NestedVisitorMap<'this, 'tcx> {
- hir::intravisit::NestedVisitorMap::OnlyBodies(&self.cx.tcx.map)
+ hir::intravisit::NestedVisitorMap::OnlyBodies(&self.cx.tcx.hir)
}
}
diff --git a/rust-nightly-date b/rust-nightly-date
index 5e1c20c71d9..59e27d02131 100644
--- a/rust-nightly-date
+++ b/rust-nightly-date
@@ -1 +1 @@
-2017-01-23
+2017-02-05