Skip to content

Commit 080fb76

Browse files
Remove dependency on rustc_plugin from servo
1 parent b0f93b9 commit 080fb76

35 files changed

+5
-74
lines changed

collector/benchmarks/script-servo/components/dom_struct/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub fn dom_struct(args: TokenStream, input: TokenStream) -> TokenStream {
1616
}
1717
let attributes = quote! {
1818
#[derive(DenyPublicFields, DomObject, JSTraceable, MallocSizeOf)]
19-
#[must_root]
2019
#[repr(C)]
2120
};
2221
let attributes = attributes.to_string().parse().unwrap();

collector/benchmarks/script-servo/components/script/Cargo.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ path = "lib.rs"
1414
[features]
1515
debugmozjs = ['js/debugmozjs']
1616
unstable = ["servo_allocator/unstable"]
17-
unrooted_must_root_lint = ["script_plugins/unrooted_must_root_lint"]
18-
default = ["unrooted_must_root_lint"]
17+
default = []
1918

2019
[build-dependencies]
2120
cmake = "0.1"
@@ -75,7 +74,6 @@ ref_filter_map = "1.0.1"
7574
ref_slice = "1.0"
7675
regex = "0.2"
7776
script_layout_interface = {path = "../script_layout_interface"}
78-
script_plugins = {path = "../script_plugins"}
7977
script_traits = {path = "../script_traits"}
8078
selectors = { path = "../selectors" }
8179
serde = "1.0"

collector/benchmarks/script-servo/components/script/document_loader.rs

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ impl LoadType {
4242
/// created via DocumentLoader::fetch_async) are always removed by the time
4343
/// that the owner is destroyed.
4444
#[derive(JSTraceable, MallocSizeOf)]
45-
#[must_root]
4645
pub struct LoadBlocker {
4746
/// The document whose load event is blocked by this object existing.
4847
doc: Dom<Document>,

collector/benchmarks/script-servo/components/script/dom/bindings/callback.rs

-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ pub enum ExceptionHandling {
3636
/// A common base class for representing IDL callback function and
3737
/// callback interface types.
3838
#[derive(JSTraceable)]
39-
#[must_root]
4039
pub struct CallbackObject {
4140
/// The underlying `JSObject`.
4241
callback: Heap<*mut JSObject>,
@@ -127,7 +126,6 @@ pub trait CallbackContainer {
127126

128127
/// A common base class for representing IDL callback function types.
129128
#[derive(JSTraceable, PartialEq)]
130-
#[must_root]
131129
pub struct CallbackFunction {
132130
object: CallbackObject,
133131
}
@@ -158,7 +156,6 @@ impl CallbackFunction {
158156

159157
/// A common base class for representing IDL callback interface types.
160158
#[derive(JSTraceable, PartialEq)]
161-
#[must_root]
162159
pub struct CallbackInterface {
163160
object: CallbackObject,
164161
}

collector/benchmarks/script-servo/components/script/dom/bindings/codegen/CodegenRust.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6070,7 +6070,7 @@ def struct(self):
60706070
derive = ["JSTraceable"]
60716071
mustRoot = ""
60726072
if self.membersNeedTracing():
6073-
mustRoot = "#[must_root]\n"
6073+
mustRoot = ""
60746074
derive += ["Default"]
60756075

60766076
return (string.Template(
@@ -6522,7 +6522,7 @@ def __init__(self, idlObject, descriptorProvider, baseName, methods,
65226522
bases=[ClassBase(baseName)],
65236523
constructors=self.getConstructors(),
65246524
methods=realMethods + getters + setters,
6525-
decorators="#[derive(JSTraceable, PartialEq)]\n#[allow_unrooted_interior]")
6525+
decorators="#[derive(JSTraceable, PartialEq)]")
65266526

65276527
def getConstructors(self):
65286528
return [ClassConstructor(

collector/benchmarks/script-servo/components/script/dom/bindings/refcounted.rs

-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ impl TrustedPromise {
145145
/// shared among threads for use in asynchronous operations. The underlying
146146
/// DOM object is guaranteed to live at least as long as the last outstanding
147147
/// `Trusted<T>` instance.
148-
#[allow_unrooted_interior]
149148
pub struct Trusted<T: DomObject> {
150149
/// A pointer to the Rust DOM object of type T, but void to allow
151150
/// sending `Trusted<T>` between threads, regardless of T's sendability.

collector/benchmarks/script-servo/components/script/dom/bindings/reflector.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ pub fn reflect_dom_object<T, U>(
2828
/// A struct to store a reference to the reflector of a DOM object.
2929
#[allow(unrooted_must_root)]
3030
#[derive(MallocSizeOf)]
31-
#[must_root]
3231
// If you're renaming or moving this field, update the path in plugins::reflector as well
3332
pub struct Reflector {
3433
#[ignore_malloc_size_of = "defined and measured in rust-mozjs"]

collector/benchmarks/script-servo/components/script/dom/bindings/root.rs

-6
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ use style::thread_state;
4848

4949
/// A rooted value.
5050
#[allow(unrooted_must_root)]
51-
#[allow_unrooted_interior]
5251
pub struct Root<T: StableTraceObject> {
5352
/// The value to root.
5453
value: T,
@@ -310,7 +309,6 @@ impl<'root, T: RootedReference<'root> + 'root> RootedReference<'root> for Option
310309
/// on the stack, the `Dom<T>` can point to freed memory.
311310
///
312311
/// This should only be used as a field in other DOM objects.
313-
#[must_root]
314312
pub struct Dom<T> {
315313
ptr: NonZero<*const T>,
316314
}
@@ -372,7 +370,6 @@ unsafe impl<T: DomObject> JSTraceable for Dom<T> {
372370

373371
/// An unrooted reference to a DOM object for use in layout. `Layout*Helpers`
374372
/// traits must be implemented on this.
375-
#[allow_unrooted_interior]
376373
pub struct LayoutDom<T> {
377374
ptr: NonZero<*const T>,
378375
}
@@ -484,7 +481,6 @@ impl LayoutDom<Node> {
484481
///
485482
/// This should only be used as a field in other DOM objects; see warning
486483
/// on `Dom<T>`.
487-
#[must_root]
488484
#[derive(JSTraceable)]
489485
pub struct MutDom<T: DomObject> {
490486
val: UnsafeCell<Dom<T>>,
@@ -545,7 +541,6 @@ impl<T: DomObject + PartialEq> PartialEq<T> for MutDom<T> {
545541
///
546542
/// This should only be used as a field in other DOM objects; see warning
547543
/// on `Dom<T>`.
548-
#[must_root]
549544
#[derive(JSTraceable)]
550545
pub struct MutNullableDom<T: DomObject> {
551546
ptr: UnsafeCell<Option<Dom<T>>>,
@@ -648,7 +643,6 @@ impl<T: DomObject> MallocSizeOf for MutNullableDom<T> {
648643
///
649644
/// This should only be used as a field in other DOM objects; see warning
650645
/// on `Dom<T>`.
651-
#[must_root]
652646
pub struct DomOnceCell<T: DomObject> {
653647
ptr: OnceCell<Dom<T>>,
654648
}

collector/benchmarks/script-servo/components/script/dom/bindings/trace.rs

-3
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,6 @@ impl<'a, T: JSTraceable + 'static> Drop for RootedTraceable<'a, T> {
750750
/// If you have GC things like *mut JSObject or JSVal, use rooted!.
751751
/// If you have an arbitrary number of DomObjects to root, use rooted_vec!.
752752
/// If you know what you're doing, use this.
753-
#[allow_unrooted_interior]
754753
pub struct RootedTraceableBox<T: 'static + JSTraceable> {
755754
ptr: *mut T,
756755
}
@@ -812,7 +811,6 @@ impl<T: JSTraceable + 'static> Drop for RootedTraceableBox<T> {
812811
/// iterator of `DomRoot`s, `rooted_vec!(let v <- iterator);`.
813812
#[allow(unrooted_must_root)]
814813
#[derive(JSTraceable)]
815-
#[allow_unrooted_interior]
816814
pub struct RootableVec<T: JSTraceable> {
817815
v: Vec<T>,
818816
}
@@ -827,7 +825,6 @@ impl<T: JSTraceable> RootableVec<T> {
827825
}
828826

829827
/// A vector of items that are rooted for the lifetime 'a.
830-
#[allow_unrooted_interior]
831828
pub struct RootedVec<'a, T: 'static + JSTraceable> {
832829
root: &'a mut RootableVec<T>,
833830
}

collector/benchmarks/script-servo/components/script/dom/bindings/weakref.rs

-4
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ use std::ops::{Deref, DerefMut, Drop};
3030
pub const DOM_WEAK_SLOT: u32 = 1;
3131

3232
/// A weak reference to a JS-managed DOM object.
33-
#[allow_unrooted_interior]
3433
pub struct WeakRef<T: WeakReferenceable> {
3534
ptr: NonZero<*mut WeakBox<T>>,
3635
}
3736

3837
/// The inner box of weak references, public for the finalization in codegen.
39-
#[must_root]
4038
pub struct WeakBox<T: WeakReferenceable> {
4139
/// The reference count. When it reaches zero, the `value` field should
4240
/// have already been set to `None`. The pointee contributes one to the count.
@@ -209,7 +207,6 @@ unsafe impl<T: WeakReferenceable> JSTraceable for MutableWeakRef<T> {
209207

210208
/// A vector of weak references. On tracing, the vector retains
211209
/// only references which still point to live objects.
212-
#[allow_unrooted_interior]
213210
#[derive(MallocSizeOf)]
214211
pub struct WeakRefVec<T: WeakReferenceable> {
215212
vec: Vec<WeakRef<T>>,
@@ -256,7 +253,6 @@ impl<T: WeakReferenceable> DerefMut for WeakRefVec<T> {
256253

257254
/// An entry of a vector of weak references. Passed to the closure
258255
/// given to `WeakRefVec::update`.
259-
#[allow_unrooted_interior]
260256
pub struct WeakRefEntry<'a, T: WeakReferenceable + 'a> {
261257
vec: &'a mut WeakRefVec<T>,
262258
index: &'a mut usize,

collector/benchmarks/script-servo/components/script/dom/blob.rs

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ pub struct FileBlob {
3333

3434

3535
/// Different backends of Blob
36-
#[must_root]
3736
#[derive(JSTraceable)]
3837
pub enum BlobImpl {
3938
/// File-based blob, whose content lives in the net process

collector/benchmarks/script-servo/components/script/dom/canvasrenderingcontext2d.rs

-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ use std::str::FromStr;
5050
use std::sync::Arc;
5151
use unpremultiplytable::UNPREMULTIPLY_TABLE;
5252

53-
#[must_root]
5453
#[derive(Clone, JSTraceable, MallocSizeOf)]
5554
#[allow(dead_code)]
5655
enum CanvasFillOrStrokeStyle {
@@ -80,7 +79,6 @@ pub struct CanvasRenderingContext2D {
8079
origin_clean: Cell<bool>,
8180
}
8281

83-
#[must_root]
8482
#[derive(Clone, JSTraceable, MallocSizeOf)]
8583
struct CanvasContextState {
8684
global_alpha: f64,

collector/benchmarks/script-servo/components/script/dom/cssstyledeclaration.rs

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ pub struct CSSStyleDeclaration {
3434
}
3535

3636
#[derive(JSTraceable, MallocSizeOf)]
37-
#[must_root]
3837
pub enum CSSStyleOwner {
3938
Element(Dom<Element>),
4039
CSSRule(Dom<CSSRule>,

collector/benchmarks/script-servo/components/script/dom/customelementregistry.rs

-3
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@ pub fn try_upgrade_element(element: &Element) {
581581
}
582582

583583
#[derive(JSTraceable, MallocSizeOf)]
584-
#[must_root]
585584
pub enum CustomElementReaction {
586585
Upgrade(
587586
#[ignore_malloc_size_of = "Rc"]
@@ -625,7 +624,6 @@ enum BackupElementQueueFlag {
625624

626625
/// <https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack>
627626
#[derive(JSTraceable, MallocSizeOf)]
628-
#[must_root]
629627
pub struct CustomElementReactionStack {
630628
stack: DomRefCell<Vec<ElementQueue>>,
631629
backup_queue: ElementQueue,
@@ -774,7 +772,6 @@ impl CustomElementReactionStack {
774772

775773
/// <https://html.spec.whatwg.org/multipage/#element-queue>
776774
#[derive(JSTraceable, MallocSizeOf)]
777-
#[must_root]
778775
struct ElementQueue {
779776
queue: DomRefCell<VecDeque<Dom<Element>>>,
780777
}

collector/benchmarks/script-servo/components/script/dom/document.rs

-3
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ impl PendingRestyle {
204204
}
205205

206206
#[derive(Clone, JSTraceable, MallocSizeOf)]
207-
#[must_root]
208207
struct StyleSheetInDocument {
209208
#[ignore_malloc_size_of = "Arc"]
210209
sheet: Arc<Stylesheet>,
@@ -4026,7 +4025,6 @@ impl AnimationFrameCallback {
40264025
}
40274026

40284027
#[derive(Default, JSTraceable, MallocSizeOf)]
4029-
#[must_root]
40304028
struct PendingInOrderScriptVec {
40314029
scripts: DomRefCell<VecDeque<PendingScript>>,
40324030
}
@@ -4059,7 +4057,6 @@ impl PendingInOrderScriptVec {
40594057
}
40604058

40614059
#[derive(JSTraceable, MallocSizeOf)]
4062-
#[must_root]
40634060
struct PendingScript {
40644061
element: Dom<HTMLScriptElement>,
40654062
load: Option<ScriptResult>,

collector/benchmarks/script-servo/components/script/dom/htmlcanvaselement.rs

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ use style::attr::{AttrValue, LengthOrPercentageOrAuto};
4343
const DEFAULT_WIDTH: u32 = 300;
4444
const DEFAULT_HEIGHT: u32 = 150;
4545

46-
#[must_root]
4746
#[derive(Clone, JSTraceable, MallocSizeOf)]
4847
pub enum CanvasContext {
4948
Context2d(Dom<CanvasRenderingContext2D>),

collector/benchmarks/script-servo/components/script/dom/htmlimageelement.rs

-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ enum ImageRequestPhase {
106106
Current
107107
}
108108
#[derive(JSTraceable, MallocSizeOf)]
109-
#[must_root]
110109
struct ImageRequest {
111110
state: State,
112111
parsed_url: Option<ServoUrl>,

collector/benchmarks/script-servo/components/script/dom/htmlinputelement.rs

-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ pub struct HTMLInputElement {
102102
}
103103

104104
#[derive(JSTraceable)]
105-
#[must_root]
106105
#[derive(MallocSizeOf)]
107106
struct InputActivationState {
108107
indeterminate: bool,

collector/benchmarks/script-servo/components/script/dom/nodelist.rs

-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use dom_struct::dom_struct;
1313
use std::cell::Cell;
1414

1515
#[derive(JSTraceable, MallocSizeOf)]
16-
#[must_root]
1716
pub enum NodeListType {
1817
Simple(Vec<Dom<Node>>),
1918
Children(ChildrenList),
@@ -110,7 +109,6 @@ impl NodeList {
110109
}
111110

112111
#[derive(JSTraceable, MallocSizeOf)]
113-
#[must_root]
114112
pub struct ChildrenList {
115113
node: Dom<Node>,
116114
#[ignore_malloc_size_of = "Defined in rust-mozjs"]

collector/benchmarks/script-servo/components/script/dom/paintworkletglobalscope.rs

-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ pub enum PaintWorkletTask {
465465
/// This type is dangerous, because it contains uboxed `Heap<JSVal>` values,
466466
/// which can't be moved.
467467
#[derive(JSTraceable, MallocSizeOf)]
468-
#[must_root]
469468
struct PaintDefinition {
470469
class_constructor: Heap<JSVal>,
471470
paint_function: Heap<JSVal>,

collector/benchmarks/script-servo/components/script/dom/range.rs

-1
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,6 @@ impl RangeMethods for Range {
934934
}
935935

936936
#[derive(DenyPublicFields, JSTraceable, MallocSizeOf)]
937-
#[must_root]
938937
pub struct BoundaryPoint {
939938
node: MutDom<Node>,
940939
offset: Cell<u32>,

collector/benchmarks/script-servo/components/script/dom/servoparser/async_html.rs

-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ fn create_buffer_queue(mut buffers: VecDeque<SendTendril<UTF8>>) -> BufferQueue
166166
// |_____________| |_______________|
167167
//
168168
#[derive(JSTraceable, MallocSizeOf)]
169-
#[must_root]
170169
pub struct Tokenizer {
171170
document: Dom<Document>,
172171
#[ignore_malloc_size_of = "Defined in std"]

collector/benchmarks/script-servo/components/script/dom/servoparser/html.rs

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use servo_url::ServoUrl;
2929
use std::io;
3030

3131
#[derive(JSTraceable, MallocSizeOf)]
32-
#[must_root]
3332
pub struct Tokenizer {
3433
#[ignore_malloc_size_of = "Defined in html5ever"]
3534
inner: HtmlTokenizer<TreeBuilder<Dom<Node>, Sink>>,

collector/benchmarks/script-servo/components/script/dom/servoparser/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,6 @@ enum ParserKind {
497497
}
498498

499499
#[derive(JSTraceable, MallocSizeOf)]
500-
#[must_root]
501500
enum Tokenizer {
502501
Html(self::html::Tokenizer),
503502
AsyncHtml(self::async_html::Tokenizer),
@@ -740,7 +739,6 @@ fn insert(parent: &Node, reference_child: Option<&Node>, child: NodeOrText<Dom<N
740739
}
741740

742741
#[derive(JSTraceable, MallocSizeOf)]
743-
#[must_root]
744742
pub struct Sink {
745743
base_url: ServoUrl,
746744
document: Dom<Document>,

collector/benchmarks/script-servo/components/script/dom/servoparser/xml.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use xml5ever::tokenizer::XmlTokenizer;
1717
use xml5ever::tree_builder::{Tracer as XmlTracer, XmlTreeBuilder};
1818

1919
#[derive(JSTraceable, MallocSizeOf)]
20-
#[must_root]
2120
pub struct Tokenizer {
2221
#[ignore_malloc_size_of = "Defined in xml5ever"]
2322
inner: XmlTokenizer<XmlTreeBuilder<Dom<Node>, Sink>>,

collector/benchmarks/script-servo/components/script/dom/webgl_extensions/extensions.rs

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ impl WebGLExtensionFeatures {
8282
}
8383

8484
/// Handles the list of implemented, supported and enabled WebGL extensions.
85-
#[must_root]
8685
#[derive(JSTraceable, MallocSizeOf)]
8786
pub struct WebGLExtensions {
8887
extensions: DomRefCell<HashMap<String, Box<WebGLExtensionWrapper>>>,

collector/benchmarks/script-servo/components/script/dom/webgl_extensions/wrapper.rs

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub trait WebGLExtensionWrapper: JSTraceable + MallocSizeOf {
2626
fn as_any(&self) -> &Any;
2727
}
2828

29-
#[must_root]
3029
#[derive(JSTraceable, MallocSizeOf)]
3130
pub struct TypedWebGLExtensionWrapper<T: WebGLExtension> {
3231
extension: MutNullableDom<T::Extension>

collector/benchmarks/script-servo/components/script/dom/webglframebuffer.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use dom::window::Window;
1818
use dom_struct::dom_struct;
1919
use std::cell::Cell;
2020

21-
#[must_root]
2221
#[derive(Clone, JSTraceable, MallocSizeOf)]
2322
enum WebGLFramebufferAttachment {
2423
Renderbuffer(Dom<WebGLRenderbuffer>),

0 commit comments

Comments
 (0)