servo: Merge #15351 - Upgrade to rustc 1.17.0-nightly (ea7a6486a 2017-02-04) (from servo:rustup); r=nox

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

Source-Repo: https://github.com/servo/servo
Source-Revision: cd63f1b158807035d2a83584e64329015a3fff4d

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 135578c533b1a0fed9a9cfeaa14524db12994337
This commit is contained in:
Simon Sapin 2017-02-05 07:01:32 -08:00
parent fca6258f36
commit c14091e80b
4 changed files with 16 additions and 14 deletions

View File

@ -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");
}
}

View File

@ -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,

View File

@ -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)
}
}

View File

@ -1 +1 @@
2017-01-23
2017-02-05