Skip to content

Commit 64516db

Browse files
committed
servo: Merge #15715 - Make #[dom_struct] a proc_macro attribute (from nox:custom-derive); r=SimonSapin
The rustup is needed for rust-lang/rust#40039. Source-Repo: https://github.com/servo/servo Source-Revision: a204c4176dcccdad8ec99d74055c66794c3f64ba UltraBlame original commit: b439aae221f2298caa3f41781ce3dfbd0b36d8ad
1 parent 73bceae commit 64516db

File tree

253 files changed

+1764
-308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

253 files changed

+1764
-308
lines changed

servo/Cargo.lock

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
[
2+
package
3+
]
4+
name
5+
=
6+
"
7+
dom_struct
8+
"
9+
version
10+
=
11+
"
12+
0
13+
.
14+
0
15+
.
16+
1
17+
"
18+
authors
19+
=
20+
[
21+
"
22+
The
23+
Servo
24+
Project
25+
Developers
26+
"
27+
]
28+
license
29+
=
30+
"
31+
MPL
32+
-
33+
2
34+
.
35+
0
36+
"
37+
publish
38+
=
39+
false
40+
[
41+
lib
42+
]
43+
path
44+
=
45+
"
46+
lib
47+
.
48+
rs
49+
"
50+
proc
51+
-
52+
macro
53+
=
54+
true
55+
[
56+
dependencies
57+
]
58+
quote
59+
=
60+
"
61+
0
62+
.
63+
3
64+
"

servo/components/dom_struct/lib.rs

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
#
2+
!
3+
[
4+
feature
5+
(
6+
proc_macro
7+
)
8+
]
9+
extern
10+
crate
11+
proc_macro
12+
;
13+
#
14+
[
15+
macro_use
16+
]
17+
extern
18+
crate
19+
quote
20+
;
21+
use
22+
proc_macro
23+
:
24+
:
25+
TokenStream
26+
;
27+
#
28+
[
29+
proc_macro_attribute
30+
]
31+
pub
32+
fn
33+
dom_struct
34+
(
35+
args
36+
:
37+
TokenStream
38+
input
39+
:
40+
TokenStream
41+
)
42+
-
43+
>
44+
TokenStream
45+
{
46+
if
47+
!
48+
args
49+
.
50+
to_string
51+
(
52+
)
53+
.
54+
is_empty
55+
(
56+
)
57+
{
58+
panic
59+
!
60+
(
61+
"
62+
#
63+
[
64+
dom_struct
65+
]
66+
takes
67+
no
68+
arguments
69+
"
70+
)
71+
;
72+
}
73+
expand_string
74+
(
75+
&
76+
input
77+
.
78+
to_string
79+
(
80+
)
81+
)
82+
.
83+
parse
84+
(
85+
)
86+
.
87+
unwrap
88+
(
89+
)
90+
}
91+
fn
92+
expand_string
93+
(
94+
input
95+
:
96+
&
97+
str
98+
)
99+
-
100+
>
101+
String
102+
{
103+
let
104+
mut
105+
tokens
106+
=
107+
quote
108+
!
109+
{
110+
#
111+
[
112+
derive
113+
(
114+
DenyPublicFields
115+
DomObject
116+
HeapSizeOf
117+
JSTraceable
118+
)
119+
]
120+
#
121+
[
122+
must_root
123+
]
124+
#
125+
[
126+
repr
127+
(
128+
C
129+
)
130+
]
131+
}
132+
;
133+
tokens
134+
.
135+
append
136+
(
137+
input
138+
)
139+
;
140+
tokens
141+
.
142+
to_string
143+
(
144+
)
145+
}

servo/components/script/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,18 @@ path
301301
devtools_traits
302302
"
303303
}
304+
dom_struct
305+
=
306+
{
307+
path
308+
=
309+
"
310+
.
311+
.
312+
/
313+
dom_struct
314+
"
315+
}
304316
domobject_derive
305317
=
306318
{

servo/components/script/docs/JS-Servos-only-GC.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,12 @@ API
13471347
/
13481348
document
13491349
rust
1350+
use
1351+
dom_struct
1352+
:
1353+
:
1354+
dom_struct
1355+
;
13501356
#
13511357
[
13521358
dom_struct

servo/components/script/dom/attr.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ window
124124
Window
125125
;
126126
use
127+
dom_struct
128+
:
129+
:
130+
dom_struct
131+
;
132+
use
127133
html5ever_atoms
128134
:
129135
:

servo/components/script/dom/beforeunloadevent.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ window
140140
Window
141141
;
142142
use
143+
dom_struct
144+
:
145+
:
146+
dom_struct
147+
;
148+
use
143149
servo_atoms
144150
:
145151
:

servo/components/script/dom/bindings/iterable.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ globalscope
116116
GlobalScope
117117
;
118118
use
119+
dom_struct
120+
:
121+
:
122+
dom_struct
123+
;
124+
use
119125
js
120126
:
121127
:

servo/components/script/dom/blob.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ globalscope
126126
GlobalScope
127127
;
128128
use
129+
dom_struct
130+
:
131+
:
132+
dom_struct
133+
;
134+
use
129135
encoding
130136
:
131137
:

servo/components/script/dom/bluetooth.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,12 @@ promise
370370
Promise
371371
;
372372
use
373+
dom_struct
374+
:
375+
:
376+
dom_struct
377+
;
378+
use
373379
ipc_channel
374380
:
375381
:

0 commit comments

Comments
 (0)