diff options
Diffstat (limited to 'components/script/dom/bindings/root.rs')
-rw-r--r-- | components/script/dom/bindings/root.rs | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 1e67474ea99..68f754628bc 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -44,8 +44,8 @@ use crate::dom::bindings::trace::{trace_reflector, JSTraceable}; use crate::dom::node::Node; /// A rooted value. -#[allow(unrooted_must_root)] -#[unrooted_must_root_lint::allow_unrooted_interior] +#[allow(crown::unrooted_must_root)] +#[crown::unrooted_must_root_lint::allow_unrooted_interior] pub struct Root<T: StableTraceObject> { /// The value to root. value: T, @@ -60,7 +60,7 @@ where /// Create a new stack-bounded root for the provided value. /// It cannot outlive its associated `RootCollection`, and it gives /// out references which cannot outlive this new `Root`. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub unsafe fn new(value: T) -> Self { unsafe fn add_to_root_list(object: *const dyn JSTraceable) -> *const RootCollection { assert_in_script(); @@ -92,7 +92,7 @@ where // The JSTraceable impl for Reflector doesn't actually do anything, // so we need this shenanigan to actually trace the reflector of the // T pointer in Dom<T>. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] struct ReflectorStackRoot(Reflector); unsafe impl JSTraceable for ReflectorStackRoot { unsafe fn trace(&self, tracer: *mut JSTracer) { @@ -111,7 +111,7 @@ where // The JSTraceable impl for Reflector doesn't actually do anything, // so we need this shenanigan to actually trace the reflector of the // T pointer in Dom<T>. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] struct MaybeUnreflectedStackRoot<T>(T); unsafe impl<T> JSTraceable for MaybeUnreflectedStackRoot<T> where @@ -316,7 +316,7 @@ where /// on the stack, the `Dom<T>` can point to freed memory. /// /// This should only be used as a field in other DOM objects. -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] pub struct Dom<T> { ptr: ptr::NonNull<T>, } @@ -341,7 +341,7 @@ impl<T> Dom<T> { impl<T: DomObject> Dom<T> { /// Create a Dom<T> from a &T - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub fn from_ref(obj: &T) -> Dom<T> { assert_in_script(); Dom { @@ -375,7 +375,7 @@ unsafe impl<T: DomObject> JSTraceable for Dom<T> { } /// A traced reference to a DOM object that may not be reflected yet. -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] pub struct MaybeUnreflectedDom<T> { ptr: ptr::NonNull<T>, } @@ -384,7 +384,7 @@ impl<T> MaybeUnreflectedDom<T> where T: DomObject, { - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub unsafe fn from_box(value: Box<T>) -> Self { Self { ptr: Box::leak(value).into(), @@ -416,7 +416,7 @@ where /// An unrooted reference to a DOM object for use in layout. `Layout*Helpers` /// traits must be implemented on this. -#[unrooted_must_root_lint::allow_unrooted_interior] +#[crown::unrooted_must_root_lint::allow_unrooted_interior] pub struct LayoutDom<'dom, T> { value: &'dom T, } @@ -505,7 +505,7 @@ impl<T> Hash for LayoutDom<'_, T> { impl<T> Clone for Dom<T> { #[inline] - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] fn clone(&self) -> Self { assert_in_script(); Dom { @@ -539,7 +539,7 @@ impl LayoutDom<'_, Node> { /// /// This should only be used as a field in other DOM objects; see warning /// on `Dom<T>`. -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] #[derive(JSTraceable)] pub struct MutDom<T: DomObject> { val: UnsafeCell<Dom<T>>, @@ -602,7 +602,7 @@ pub(crate) fn assert_in_layout() { /// /// This should only be used as a field in other DOM objects; see warning /// on `Dom<T>`. -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] #[derive(JSTraceable)] pub struct MutNullableDom<T: DomObject> { ptr: UnsafeCell<Option<Dom<T>>>, @@ -636,14 +636,14 @@ impl<T: DomObject> MutNullableDom<T> { /// Retrieve a copy of the inner optional `Dom<T>` as `LayoutDom<T>`. /// For use by layout, which can't use safe types like Temporary. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub unsafe fn get_inner_as_layout(&self) -> Option<LayoutDom<T>> { assert_in_layout(); (*self.ptr.get()).as_ref().map(|js| js.to_layout()) } /// Get a rooted value out of this object - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub fn get(&self) -> Option<DomRoot<T>> { assert_in_script(); unsafe { ptr::read(self.ptr.get()).map(|o| DomRoot::from_ref(&*o)) } @@ -678,7 +678,7 @@ impl<'a, T: DomObject> PartialEq<Option<&'a T>> for MutNullableDom<T> { } impl<T: DomObject> Default for MutNullableDom<T> { - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] fn default() -> MutNullableDom<T> { assert_in_script(); MutNullableDom { @@ -700,7 +700,7 @@ impl<T: DomObject> MallocSizeOf for MutNullableDom<T> { /// /// This should only be used as a field in other DOM objects; see warning /// on `Dom<T>`. -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] pub struct DomOnceCell<T: DomObject> { ptr: OnceCell<Dom<T>>, } @@ -711,7 +711,7 @@ where { /// Retrieve a copy of the current inner value. If it is `None`, it is /// initialized with the result of `cb` first. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub fn init_once<F>(&self, cb: F) -> &T where F: FnOnce() -> DomRoot<T>, @@ -722,7 +722,7 @@ where } impl<T: DomObject> Default for DomOnceCell<T> { - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] fn default() -> DomOnceCell<T> { assert_in_script(); DomOnceCell { @@ -738,7 +738,7 @@ impl<T: DomObject> MallocSizeOf for DomOnceCell<T> { } } -#[allow(unrooted_must_root)] +#[allow(crown::unrooted_must_root)] unsafe impl<T: DomObject> JSTraceable for DomOnceCell<T> { unsafe fn trace(&self, trc: *mut JSTracer) { if let Some(ptr) = self.ptr.get() { |