Add unrooted_must_root lint for enums and structs containing JS<T>, as well as functions with JS<T> in their parameter list

For safe wrappers over JS<T> (eg Temporary<T>) use #[allow(unrooted_must_root)].
For all other types containing a #[must_root] value, annotate the type with #[must_root] to ensure that it is never used unrooted
This commit is contained in:
Manish Goregaokar 2014-09-16 01:28:36 +05:30
parent 13ae369dec
commit 12dc54d238
22 changed files with 101 additions and 4 deletions

View file

@ -30,12 +30,14 @@ impl<S: Encoder<E>, E> Encodable<S, E> for Box<CollectionFilter> {
}
#[deriving(Encodable)]
#[must_root]
pub enum CollectionTypeId {
Static(Vec<JS<Element>>),
Live(JS<Node>, Box<CollectionFilter>)
}
#[deriving(Encodable)]
#[must_root]
pub struct HTMLCollection {
collection: CollectionTypeId,
reflector_: Reflector,