diff options
Diffstat (limited to 'components/script/dom/bindings/trace.rs')
-rw-r--r-- | components/script/dom/bindings/trace.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index ab2b20b97c8..cdb2fd425ac 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -745,6 +745,7 @@ impl<'a, T: JSTraceable + 'static> Drop for RootedTraceable<'a, T> { /// If you have GC things like *mut JSObject or JSVal, use rooted!. /// If you have an arbitrary number of DomObjects to root, use rooted_vec!. /// If you know what you're doing, use this. +#[allow_unrooted_interior] pub struct RootedTraceableBox<T: 'static + JSTraceable> { ptr: *mut T, } @@ -768,6 +769,12 @@ impl<T: JSTraceable + 'static> RootedTraceableBox<T> { } } +impl<T: JSTraceable + Default> Default for RootedTraceableBox<T> { + fn default() -> RootedTraceableBox<T> { + RootedTraceableBox::new(T::default()) + } +} + impl<T: JSTraceable> Deref for RootedTraceableBox<T> { type Target = T; fn deref(&self) -> &T { |