mirror of
https://github.com/servo/servo.git
synced 2025-07-03 05:23:38 +01:00
Upgrade to rustc 1.17.0-nightly (ea7a6486a 2017-02-04)
This commit is contained in:
parent
fb7f65fc57
commit
1aa0b16299
4 changed files with 16 additions and 14 deletions
|
@ -27,7 +27,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InheritancePass {
|
||||||
_gen: &hir::Generics, id: ast::NodeId) {
|
_gen: &hir::Generics, id: ast::NodeId) {
|
||||||
// Lints are run post expansion, so it's fine to use
|
// Lints are run post expansion, so it's fine to use
|
||||||
// #[_dom_struct_marker] here without also checking for #[dom_struct]
|
// #[_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
|
// Find the reflector, if any
|
||||||
let reflector_span = def.fields().iter().enumerate()
|
let reflector_span = def.fields().iter().enumerate()
|
||||||
.find(|&(ctr, f)| {
|
.find(|&(ctr, f)| {
|
||||||
|
@ -66,7 +66,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InheritancePass {
|
||||||
if let Some(sp) = reflector_span {
|
if let Some(sp) = reflector_span {
|
||||||
if dom_spans.len() > 0 {
|
if dom_spans.len() > 0 {
|
||||||
let mut db = cx.struct_span_lint(INHERITANCE_INTEGRITY,
|
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 \
|
"This DOM struct has both Reflector \
|
||||||
and bare DOM struct members");
|
and bare DOM struct members");
|
||||||
if cx.current_level(INHERITANCE_INTEGRITY) != Level::Allow {
|
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
|
// Nor should we have more than one dom struct field
|
||||||
} else if dom_spans.len() > 1 {
|
} else if dom_spans.len() > 1 {
|
||||||
let mut db = cx.struct_span_lint(INHERITANCE_INTEGRITY,
|
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 \
|
"This DOM struct has multiple \
|
||||||
DOM struct members, only one is allowed");
|
DOM struct members, only one is allowed");
|
||||||
if cx.current_level(INHERITANCE_INTEGRITY) != Level::Allow {
|
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() {
|
} 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");
|
"This DOM struct has no reflector or parent DOM struct");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PrivatizePass {
|
||||||
_n: ast::Name,
|
_n: ast::Name,
|
||||||
_gen: &hir::Generics,
|
_gen: &hir::Generics,
|
||||||
id: ast::NodeId) {
|
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() {
|
for field in def.fields() {
|
||||||
if field.vis == hir::Public {
|
if field.vis == hir::Public {
|
||||||
cx.span_lint(PRIVATIZE, field.span,
|
cx.span_lint(PRIVATIZE, field.span,
|
||||||
|
|
|
@ -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"]) {
|
|| match_def_path(cx, did.did, &["std", "collections", "hash", "map", "VacantEntry"]) {
|
||||||
// Structures which are semantically similar to an &ptr.
|
// Structures which are semantically similar to an &ptr.
|
||||||
false
|
false
|
||||||
|
} else if did.is_box() && in_new_function {
|
||||||
|
// box in new() is okay
|
||||||
|
false
|
||||||
} else {
|
} else {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ty::TyBox(..) if in_new_function => false, // box in new() is okay
|
|
||||||
ty::TyRef(..) => false, // don't recurse down &ptrs
|
ty::TyRef(..) => false, // don't recurse down &ptrs
|
||||||
ty::TyRawPtr(..) => false, // don't recurse down *ptrs
|
ty::TyRawPtr(..) => false, // don't recurse down *ptrs
|
||||||
ty::TyFnDef(..) | ty::TyFnPtr(_) => false,
|
ty::TyFnDef(..) | ty::TyFnPtr(_) => false,
|
||||||
|
@ -84,13 +86,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnrootedPass {
|
||||||
_n: ast::Name,
|
_n: ast::Name,
|
||||||
_gen: &hir::Generics,
|
_gen: &hir::Generics,
|
||||||
id: ast::NodeId) {
|
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,
|
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")) {
|
if item.attrs.iter().all(|a| !a.check_name("must_root")) {
|
||||||
for ref field in def.fields() {
|
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) {
|
if is_unrooted_ty(cx, cx.tcx.item_type(def_id), false) {
|
||||||
cx.span_lint(UNROOTED_MUST_ROOT, field.span,
|
cx.span_lint(UNROOTED_MUST_ROOT, field.span,
|
||||||
"Type must be rooted, use #[must_root] on the struct definition to propagate")
|
"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
|
/// All enums containing #[must_root] types must be #[must_root] themselves
|
||||||
fn check_variant(&mut self, cx: &LateContext, var: &hir::Variant, _gen: &hir::Generics) {
|
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")) {
|
if map.expect_item(map.get_parent(var.node.data.id())).attrs.iter().all(|a| !a.check_name("must_root")) {
|
||||||
match var.node.data {
|
match var.node.data {
|
||||||
hir::VariantData::Tuple(ref fields, _) => {
|
hir::VariantData::Tuple(ref fields, _) => {
|
||||||
for ref field in 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) {
|
if is_unrooted_ty(cx, cx.tcx.item_type(def_id), false) {
|
||||||
cx.span_lint(UNROOTED_MUST_ROOT, field.ty.span,
|
cx.span_lint(UNROOTED_MUST_ROOT, field.ty.span,
|
||||||
"Type must be rooted, use #[must_root] on \
|
"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) {
|
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);
|
let ty = cx.tcx.item_type(def_id);
|
||||||
|
|
||||||
for (arg, ty) in decl.inputs.iter().zip(ty.fn_args().0.iter()) {
|
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_foreign_item(&mut self, _: &'tcx hir::ForeignItem) {}
|
||||||
fn visit_ty(&mut self, _: &'tcx hir::Ty) { }
|
fn visit_ty(&mut self, _: &'tcx hir::Ty) { }
|
||||||
fn nested_visit_map<'this>(&'this mut self) -> hir::intravisit::NestedVisitorMap<'this, 'tcx> {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
2017-01-23
|
2017-02-05
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue