Skip to content

Commit

Permalink
Unwrap pointers and miscellany for unrooted_must_root check
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Sep 16, 2014
1 parent bded5c3 commit d241826
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/macros/lib.rs
Expand Up @@ -62,6 +62,12 @@ impl LintPass for TransmutePass {
}

fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) {
let ty = match ty.node {
ast::TyBox(ref t) | ast::TyUniq(ref t) |
ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) |
ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => &**t,
_ => ty
};
match ty.node {
ast::TyPath(_, _, id) => {
match cx.tcx.def_map.borrow().get_copy(&id) {
Expand Down
2 changes: 2 additions & 0 deletions components/script/dom/bindings/js.rs
Expand Up @@ -113,6 +113,7 @@ pub struct JS<T> {
}

impl<T> PartialEq for JS<T> {
#[allow(unrooted_must_root)]
fn eq(&self, other: &JS<T>) -> bool {
self.ptr == other.ptr
}
Expand Down Expand Up @@ -373,6 +374,7 @@ impl RootCollection {
}

/// Create a new stack-bounded root that will not outlive this collection
#[allow(unrooted_must_root)]
fn new_root<'a, 'b, T: Reflectable>(&'a self, unrooted: &JS<T>) -> Root<'a, 'b, T> {
Root::new(self, unrooted)
}
Expand Down
1 change: 1 addition & 0 deletions components/script/dom/htmlserializer.rs
Expand Up @@ -21,6 +21,7 @@ use dom::text::Text;
use servo_util::atom::Atom;
use servo_util::namespace;

#[allow(unrooted_must_root)]
pub fn serialize(iterator: &mut NodeIterator) -> String {
let mut html = String::new();
let mut open_elements: Vec<String> = vec!();
Expand Down

0 comments on commit d241826

Please sign in to comment.