aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/plugins/lints/unrooted_must_root.rs46
-rw-r--r--components/servo/Cargo.lock4
-rw-r--r--ports/cef/Cargo.lock4
-rw-r--r--ports/geckolib/Cargo.lock4
-rw-r--r--ports/gonk/Cargo.lock4
-rw-r--r--rust-nightly-date2
6 files changed, 28 insertions, 36 deletions
diff --git a/components/plugins/lints/unrooted_must_root.rs b/components/plugins/lints/unrooted_must_root.rs
index 5f9f63a9e4b..9a9a43d62dc 100644
--- a/components/plugins/lints/unrooted_must_root.rs
+++ b/components/plugins/lints/unrooted_must_root.rs
@@ -106,15 +106,13 @@ impl LateLintPass for UnrootedPass {
let ref map = cx.tcx.map;
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 vec, _) => {
- for ty in vec {
- cx.tcx.ast_ty_to_ty_cache.borrow().get(&ty.id).map(|t| {
- if is_unrooted_ty(cx, t, false) {
- cx.span_lint(UNROOTED_MUST_ROOT, ty.ty.span,
- "Type must be rooted, use #[must_root] on \
- the enum definition to propagate")
- }
- });
+ hir::VariantData::Tuple(ref fields, _) => {
+ for ref field in fields {
+ if is_unrooted_ty(cx, cx.tcx.node_id_to_type(field.id), false) {
+ cx.span_lint(UNROOTED_MUST_ROOT, field.ty.span,
+ "Type must be rooted, use #[must_root] on \
+ the enum definition to propagate")
+ }
}
}
_ => () // Struct variants already caught by check_struct_def
@@ -123,7 +121,7 @@ impl LateLintPass for UnrootedPass {
}
/// Function arguments that are #[must_root] types are not allowed
fn check_fn(&mut self, cx: &LateContext, kind: visit::FnKind, decl: &hir::FnDecl,
- block: &hir::Block, span: codemap::Span, _id: ast::NodeId) {
+ block: &hir::Block, span: codemap::Span, id: ast::NodeId) {
let in_new_function = match kind {
visit::FnKind::ItemFn(n, _, _, _, _, _, _) |
visit::FnKind::Method(n, _, _, _) => {
@@ -132,27 +130,21 @@ impl LateLintPass for UnrootedPass {
visit::FnKind::Closure(_) => return,
};
- for arg in &decl.inputs {
- cx.tcx.ast_ty_to_ty_cache.borrow().get(&arg.ty.id).map(|t| {
- if is_unrooted_ty(cx, t, false) {
- if in_derive_expn(cx, span) {
- return;
- }
+ if !in_derive_expn(cx, span) {
+ let ty = cx.tcx.node_id_to_type(id);
+
+ for (arg, ty) in decl.inputs.iter().zip(ty.fn_args().0.iter()) {
+ if is_unrooted_ty(cx, ty, false) {
cx.span_lint(UNROOTED_MUST_ROOT, arg.ty.span, "Type must be rooted")
}
- });
- }
+ }
- if !in_new_function {
- if let hir::Return(ref ty) = decl.output {
- cx.tcx.ast_ty_to_ty_cache.borrow().get(&ty.id).map(|t| {
- if is_unrooted_ty(cx, t, false) {
- if in_derive_expn(cx, span) {
- return;
- }
- cx.span_lint(UNROOTED_MUST_ROOT, ty.span, "Type must be rooted")
+ if !in_new_function {
+ if let ty::FnOutput::FnConverging(ret) = ty.fn_ret().0 {
+ if is_unrooted_ty(cx, ret, false) {
+ cx.span_lint(UNROOTED_MUST_ROOT, decl.output.span(), "Type must be rooted")
}
- });
+ }
}
}
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 12525e2c96d..e3a2be15c64 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -1661,7 +1661,7 @@ dependencies = [
name = "plugins"
version = "0.0.1"
dependencies = [
- "tenacious 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tenacious 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -2199,7 +2199,7 @@ dependencies = [
[[package]]
name = "tenacious"
-version = "0.2.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index 535a6a4c534..9489694d494 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -1532,7 +1532,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "plugins"
version = "0.0.1"
dependencies = [
- "tenacious 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tenacious 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -2068,7 +2068,7 @@ dependencies = [
[[package]]
name = "tenacious"
-version = "0.2.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
diff --git a/ports/geckolib/Cargo.lock b/ports/geckolib/Cargo.lock
index 2c7c200ab96..b5245a85a3b 100644
--- a/ports/geckolib/Cargo.lock
+++ b/ports/geckolib/Cargo.lock
@@ -403,7 +403,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "plugins"
version = "0.0.1"
dependencies = [
- "tenacious 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tenacious 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -571,7 +571,7 @@ dependencies = [
[[package]]
name = "tenacious"
-version = "0.2.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock
index 9c1992f4566..2bdd01df785 100644
--- a/ports/gonk/Cargo.lock
+++ b/ports/gonk/Cargo.lock
@@ -1524,7 +1524,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "plugins"
version = "0.0.1"
dependencies = [
- "tenacious 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tenacious 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -2058,7 +2058,7 @@ dependencies = [
[[package]]
name = "tenacious"
-version = "0.2.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
diff --git a/rust-nightly-date b/rust-nightly-date
index 2b193f11c81..198d2457b14 100644
--- a/rust-nightly-date
+++ b/rust-nightly-date
@@ -1 +1 @@
-2016-05-07
+2016-05-14