mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Use #![register_tool]
instead of #![register_attr]
CC https://github.com/rust-lang/rust/issues/66079
This commit is contained in:
parent
091feba0ba
commit
bea73951db
46 changed files with 129 additions and 105 deletions
|
@ -40,7 +40,7 @@ pub enum ExceptionHandling {
|
|||
/// A common base class for representing IDL callback function and
|
||||
/// callback interface types.
|
||||
#[derive(JSTraceable)]
|
||||
#[must_root]
|
||||
#[unrooted_must_root_lint::must_root]
|
||||
pub struct CallbackObject {
|
||||
/// The underlying `JSObject`.
|
||||
callback: Heap<*mut JSObject>,
|
||||
|
@ -131,7 +131,7 @@ pub trait CallbackContainer {
|
|||
|
||||
/// A common base class for representing IDL callback function types.
|
||||
#[derive(JSTraceable, PartialEq)]
|
||||
#[must_root]
|
||||
#[unrooted_must_root_lint::must_root]
|
||||
pub struct CallbackFunction {
|
||||
object: CallbackObject,
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ impl CallbackFunction {
|
|||
|
||||
/// A common base class for representing IDL callback interface types.
|
||||
#[derive(JSTraceable, PartialEq)]
|
||||
#[must_root]
|
||||
#[unrooted_must_root_lint::must_root]
|
||||
pub struct CallbackInterface {
|
||||
object: CallbackObject,
|
||||
}
|
||||
|
|
|
@ -6406,7 +6406,7 @@ class CGDictionary(CGThing):
|
|||
derive = ["JSTraceable"]
|
||||
mustRoot = ""
|
||||
if self.membersNeedTracing():
|
||||
mustRoot = "#[must_root]\n"
|
||||
mustRoot = "#[unrooted_must_root_lint::must_root]\n"
|
||||
derive += ["Default"]
|
||||
|
||||
return (string.Template(
|
||||
|
@ -6927,7 +6927,8 @@ class CGCallback(CGClass):
|
|||
bases=[ClassBase(baseName)],
|
||||
constructors=self.getConstructors(),
|
||||
methods=realMethods,
|
||||
decorators="#[derive(JSTraceable, PartialEq)]\n#[allow_unrooted_interior]")
|
||||
decorators="#[derive(JSTraceable, PartialEq)]\n"
|
||||
"#[unrooted_must_root_lint::allow_unrooted_interior]")
|
||||
|
||||
def getConstructors(self):
|
||||
return [ClassConstructor(
|
||||
|
|
|
@ -151,7 +151,7 @@ impl TrustedPromise {
|
|||
/// shared among threads for use in asynchronous operations. The underlying
|
||||
/// DOM object is guaranteed to live at least as long as the last outstanding
|
||||
/// `Trusted<T>` instance.
|
||||
#[allow_unrooted_interior]
|
||||
#[unrooted_must_root_lint::allow_unrooted_interior]
|
||||
pub struct Trusted<T: DomObject> {
|
||||
/// A pointer to the Rust DOM object of type T, but void to allow
|
||||
/// sending `Trusted<T>` between threads, regardless of T's sendability.
|
||||
|
|
|
@ -30,7 +30,7 @@ where
|
|||
/// A struct to store a reference to the reflector of a DOM object.
|
||||
#[allow(unrooted_must_root)]
|
||||
#[derive(MallocSizeOf)]
|
||||
#[must_root]
|
||||
#[unrooted_must_root_lint::must_root]
|
||||
// If you're renaming or moving this field, update the path in plugins::reflector as well
|
||||
pub struct Reflector {
|
||||
#[ignore_malloc_size_of = "defined and measured in rust-mozjs"]
|
||||
|
|
|
@ -46,7 +46,7 @@ use style::thread_state;
|
|||
|
||||
/// A rooted value.
|
||||
#[allow(unrooted_must_root)]
|
||||
#[allow_unrooted_interior]
|
||||
#[unrooted_must_root_lint::allow_unrooted_interior]
|
||||
pub struct Root<T: StableTraceObject> {
|
||||
/// The value to root.
|
||||
value: T,
|
||||
|
@ -283,7 +283,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.
|
||||
#[must_root]
|
||||
#[unrooted_must_root_lint::must_root]
|
||||
pub struct Dom<T> {
|
||||
ptr: ptr::NonNull<T>,
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ unsafe impl<T: DomObject> JSTraceable for Dom<T> {
|
|||
|
||||
/// An unrooted reference to a DOM object for use in layout. `Layout*Helpers`
|
||||
/// traits must be implemented on this.
|
||||
#[allow_unrooted_interior]
|
||||
#[unrooted_must_root_lint::allow_unrooted_interior]
|
||||
pub struct LayoutDom<T> {
|
||||
ptr: ptr::NonNull<T>,
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ impl LayoutDom<Node> {
|
|||
///
|
||||
/// This should only be used as a field in other DOM objects; see warning
|
||||
/// on `Dom<T>`.
|
||||
#[must_root]
|
||||
#[unrooted_must_root_lint::must_root]
|
||||
#[derive(JSTraceable)]
|
||||
pub struct MutDom<T: DomObject> {
|
||||
val: UnsafeCell<Dom<T>>,
|
||||
|
@ -518,7 +518,7 @@ impl<T: DomObject + PartialEq> PartialEq<T> for MutDom<T> {
|
|||
///
|
||||
/// This should only be used as a field in other DOM objects; see warning
|
||||
/// on `Dom<T>`.
|
||||
#[must_root]
|
||||
#[unrooted_must_root_lint::must_root]
|
||||
#[derive(JSTraceable)]
|
||||
pub struct MutNullableDom<T: DomObject> {
|
||||
ptr: UnsafeCell<Option<Dom<T>>>,
|
||||
|
@ -616,7 +616,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>`.
|
||||
#[must_root]
|
||||
#[unrooted_must_root_lint::must_root]
|
||||
pub struct DomOnceCell<T: DomObject> {
|
||||
ptr: OnceCell<Dom<T>>,
|
||||
}
|
||||
|
|
|
@ -883,7 +883,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]
|
||||
#[unrooted_must_root_lint::allow_unrooted_interior]
|
||||
pub struct RootedTraceableBox<T: 'static + JSTraceable> {
|
||||
ptr: *mut T,
|
||||
}
|
||||
|
@ -954,7 +954,7 @@ impl<T: JSTraceable + 'static> Drop for RootedTraceableBox<T> {
|
|||
/// iterator of `DomRoot`s, `rooted_vec!(let v <- iterator);`.
|
||||
#[allow(unrooted_must_root)]
|
||||
#[derive(JSTraceable)]
|
||||
#[allow_unrooted_interior]
|
||||
#[unrooted_must_root_lint::allow_unrooted_interior]
|
||||
pub struct RootableVec<T: JSTraceable> {
|
||||
v: Vec<T>,
|
||||
}
|
||||
|
@ -967,7 +967,7 @@ impl<T: JSTraceable> RootableVec<T> {
|
|||
}
|
||||
|
||||
/// A vector of items that are rooted for the lifetime 'a.
|
||||
#[allow_unrooted_interior]
|
||||
#[unrooted_must_root_lint::allow_unrooted_interior]
|
||||
pub struct RootedVec<'a, T: 'static + JSTraceable> {
|
||||
root: &'a mut RootableVec<T>,
|
||||
}
|
||||
|
|
|
@ -34,13 +34,13 @@ pub const DOM_WEAK_SLOT: u32 = 1;
|
|||
|
||||
/// A weak reference to a JS-managed DOM object.
|
||||
#[allow(unrooted_must_root)]
|
||||
#[allow_unrooted_interior]
|
||||
#[unrooted_must_root_lint::allow_unrooted_interior]
|
||||
pub struct WeakRef<T: WeakReferenceable> {
|
||||
ptr: ptr::NonNull<WeakBox<T>>,
|
||||
}
|
||||
|
||||
/// The inner box of weak references, public for the finalization in codegen.
|
||||
#[must_root]
|
||||
#[unrooted_must_root_lint::must_root]
|
||||
pub struct WeakBox<T: WeakReferenceable> {
|
||||
/// The reference count. When it reaches zero, the `value` field should
|
||||
/// have already been set to `None`. The pointee contributes one to the count.
|
||||
|
@ -218,7 +218,7 @@ unsafe impl<T: WeakReferenceable> JSTraceable for MutableWeakRef<T> {
|
|||
|
||||
/// A vector of weak references. On tracing, the vector retains
|
||||
/// only references which still point to live objects.
|
||||
#[allow_unrooted_interior]
|
||||
#[unrooted_must_root_lint::allow_unrooted_interior]
|
||||
#[derive(MallocSizeOf)]
|
||||
pub struct WeakRefVec<T: WeakReferenceable> {
|
||||
vec: Vec<WeakRef<T>>,
|
||||
|
@ -268,7 +268,7 @@ impl<T: WeakReferenceable> DerefMut for WeakRefVec<T> {
|
|||
|
||||
/// An entry of a vector of weak references. Passed to the closure
|
||||
/// given to `WeakRefVec::update`.
|
||||
#[allow_unrooted_interior]
|
||||
#[unrooted_must_root_lint::allow_unrooted_interior]
|
||||
pub struct WeakRefEntry<'a, T: WeakReferenceable> {
|
||||
vec: &'a mut WeakRefVec<T>,
|
||||
index: &'a mut usize,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue