This commit is contained in:
Peter 2015-05-15 16:27:07 -04:00
parent f554ab1c4d
commit 717b443eec
5 changed files with 17 additions and 13 deletions

View file

@ -8,5 +8,5 @@ name = "plugins"
path = "lib.rs" path = "lib.rs"
plugin = true plugin = true
[dependencies.tenacious] [dependencies]
git = "https://github.com/Manishearth/rust-tenacious.git" tenacious = "*"

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use syntax::{ast, codemap, visit}; use syntax::{ast, codemap, visit, ast_map};
use syntax::attr::AttrMetaMethods; use syntax::attr::AttrMetaMethods;
use rustc::lint::{Context, LintPass, LintArray}; use rustc::lint::{Context, LintPass, LintArray};
use rustc::middle::ty::expr_ty; use rustc::middle::ty::expr_ty;
@ -52,7 +52,11 @@ impl LintPass for UnrootedPass {
} }
/// All structs containing #[must_root] types must be #[must_root] themselves /// All structs containing #[must_root] types must be #[must_root] themselves
fn check_struct_def(&mut self, cx: &Context, def: &ast::StructDef, _i: ast::Ident, _gen: &ast::Generics, id: ast::NodeId) { fn check_struct_def(&mut self, cx: &Context, def: &ast::StructDef, _i: ast::Ident, _gen: &ast::Generics, id: ast::NodeId) {
if cx.tcx.map.expect_item(id).attrs.iter().all(|a| !a.check_name("must_root")) { let item = match cx.tcx.map.get(id) {
ast_map::Node::NodeItem(item) => item,
_ => cx.tcx.map.expect_item(cx.tcx.map.get_parent(id)),
};
if item.attrs.iter().all(|a| !a.check_name("must_root")) {
for ref field in def.fields.iter() { for ref field in def.fields.iter() {
lint_unrooted_ty(cx, &*field.node.ty, lint_unrooted_ty(cx, &*field.node.ty,
"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");

View file

@ -937,7 +937,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "plugins" name = "plugins"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"tenacious 0.0.1 (git+https://github.com/Manishearth/rust-tenacious.git)", "tenacious 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1185,8 +1185,8 @@ dependencies = [
[[package]] [[package]]
name = "tenacious" name = "tenacious"
version = "0.0.1" version = "0.0.3"
source = "git+https://github.com/Manishearth/rust-tenacious.git#5112359cd36682cd7df3a7bb9a963299890be26c" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "time" name = "time"

6
ports/cef/Cargo.lock generated
View file

@ -927,7 +927,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "plugins" name = "plugins"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"tenacious 0.0.1 (git+https://github.com/Manishearth/rust-tenacious.git)", "tenacious 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1178,8 +1178,8 @@ dependencies = [
[[package]] [[package]]
name = "tenacious" name = "tenacious"
version = "0.0.1" version = "0.0.3"
source = "git+https://github.com/Manishearth/rust-tenacious.git#5112359cd36682cd7df3a7bb9a963299890be26c" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "time" name = "time"

6
ports/gonk/Cargo.lock generated
View file

@ -798,7 +798,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "plugins" name = "plugins"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"tenacious 0.0.1 (git+https://github.com/Manishearth/rust-tenacious.git)", "tenacious 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1048,8 +1048,8 @@ dependencies = [
[[package]] [[package]]
name = "tenacious" name = "tenacious"
version = "0.0.1" version = "0.0.3"
source = "git+https://github.com/Manishearth/rust-tenacious.git#5112359cd36682cd7df3a7bb9a963299890be26c" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "time" name = "time"