• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /// A sanity test that we can generate bindings for Stylo.
2 ///
3 /// We don't assert on expected output because its just too big. The output will
4 /// change too often, and it won't be clear what is going on at a glance, unlike
5 /// the other tests with smaller input headers.
6 ///
7 /// This test is relatively slow, so we also only run it in release mode.
8 ///
9 /// Finally, uncomment the `panic!` at the bottom of the test to get logs timing
10 /// how long bindings generation takes for Stylo. Stylo bindings generation
11 /// takes too long to be a proper `#[bench]`.
12 #[test]
13 #[cfg(not(any(
14     debug_assertions,
15     feature = "__testing_only_extra_assertions",
16 )))]
17 #[cfg(any(
18     feature = "__testing_only_libclang_9",
19     feature = "__testing_only_libclang_16"
20 ))]
sanity_check_can_generate_stylo_bindings()21 fn sanity_check_can_generate_stylo_bindings() {
22     use std::time::Instant;
23 
24     let then = Instant::now();
25 
26     bindgen::builder()
27         .time_phases(true)
28         .disable_header_comment()
29         .header(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/stylo.hpp"))
30         .allowlist_function("Servo_.*")
31         .allowlist_function("Gecko_.*")
32         .blocklist_type("nsACString_internal")
33         .blocklist_type("nsAString_internal")
34         .blocklist_type("mozilla::css::URLValue")
35         .blocklist_type("RawGeckoAnimationPropertySegment")
36         .blocklist_type("RawGeckoComputedTiming")
37         .blocklist_type("RawGeckoDocument")
38         .blocklist_type("RawGeckoElement")
39         .blocklist_type("RawGeckoKeyframeList")
40         .blocklist_type("RawGeckoComputedKeyframeValuesList")
41         .blocklist_type("RawGeckoFontFaceRuleList")
42         .blocklist_type("RawGeckoNode")
43         .blocklist_type("RawGeckoAnimationValueList")
44         .blocklist_type("RawServoAnimationValue")
45         .blocklist_type("RawServoAnimationValueMap")
46         .blocklist_type("RawServoDeclarationBlock")
47         .blocklist_type("RawGeckoPresContext")
48         .blocklist_type("RawGeckoPresContextOwned")
49         .blocklist_type("RawGeckoStyleAnimationList")
50         .blocklist_type("RawGeckoURLExtraData")
51         .blocklist_type("RefPtr")
52         .blocklist_type("CSSPseudoClassType")
53         .blocklist_type("TraversalRootBehavior")
54         .blocklist_type("ComputedTimingFunction_BeforeFlag")
55         .blocklist_type("FontFamilyList")
56         .blocklist_type("FontFamilyType")
57         .blocklist_type("Keyframe")
58         .blocklist_type("ServoBundledURI")
59         .blocklist_type("ServoElementSnapshot")
60         .blocklist_type("SheetParsingMode")
61         .blocklist_type("StyleBasicShape")
62         .blocklist_type("StyleBasicShapeType")
63         .blocklist_type("StyleShapeSource")
64         .blocklist_type("nsCSSFontFaceRule")
65         .blocklist_type("nsCSSKeyword")
66         .blocklist_type("nsCSSPropertyID")
67         .blocklist_type("nsCSSShadowArray")
68         .blocklist_type("nsCSSUnit")
69         .blocklist_type("nsCSSValue")
70         .blocklist_type("nsCSSValueSharedList")
71         .blocklist_type("nsChangeHint")
72         .blocklist_type("nsCursorImage")
73         .blocklist_type("nsFont")
74         .blocklist_type("nsIAtom")
75         .blocklist_type("nsMediaFeature")
76         .blocklist_type("nsRestyleHint")
77         .blocklist_type("nsStyleBackground")
78         .blocklist_type("nsStyleBorder")
79         .blocklist_type("nsStyleColor")
80         .blocklist_type("nsStyleColumn")
81         .blocklist_type("nsStyleContent")
82         .blocklist_type("nsStyleContentData")
83         .blocklist_type("nsStyleContentType")
84         .blocklist_type("nsStyleContext")
85         .blocklist_type("nsStyleCoord")
86         .blocklist_type("nsStyleCoord_Calc")
87         .blocklist_type("nsStyleCoord_CalcValue")
88         .blocklist_type("nsStyleDisplay")
89         .blocklist_type("nsStyleEffects")
90         .blocklist_type("nsStyleFilter")
91         .blocklist_type("nsStyleFont")
92         .blocklist_type("nsStyleGradient")
93         .blocklist_type("nsStyleGradientStop")
94         .blocklist_type("nsStyleImage")
95         .blocklist_type("nsStyleImageLayers")
96         .blocklist_type("nsStyleImageLayers_Layer")
97         .blocklist_type("nsStyleImageLayers_LayerType")
98         .blocklist_type("nsStyleImageRequest")
99         .blocklist_type("nsStyleList")
100         .blocklist_type("nsStyleMargin")
101         .blocklist_type("nsStyleOutline")
102         .blocklist_type("nsStylePadding")
103         .blocklist_type("nsStylePosition")
104         .blocklist_type("nsStyleQuoteValues")
105         .blocklist_type("nsStyleSVG")
106         .blocklist_type("nsStyleSVGPaint")
107         .blocklist_type("nsStyleSVGReset")
108         .blocklist_type("nsStyleTable")
109         .blocklist_type("nsStyleTableBorder")
110         .blocklist_type("nsStyleText")
111         .blocklist_type("nsStyleTextReset")
112         .blocklist_type("nsStyleUIReset")
113         .blocklist_type("nsStyleUnion")
114         .blocklist_type("nsStyleUnit")
115         .blocklist_type("nsStyleUserInterface")
116         .blocklist_type("nsStyleVariables")
117         .blocklist_type("nsStyleVisibility")
118         .blocklist_type("nsStyleXUL")
119         .blocklist_type("nsTimingFunction")
120         .blocklist_type("nscolor")
121         .blocklist_type("nscoord")
122         .blocklist_type("nsresult")
123         .blocklist_type("Loader")
124         .blocklist_type("ServoStyleSheet")
125         .blocklist_type("EffectCompositor_CascadeLevel")
126         .blocklist_type("UpdateAnimationsTasks")
127         .blocklist_type("nsTArrayBorrowed_uintptr_t")
128         .blocklist_type("ServoCssRulesStrong")
129         .blocklist_type("ServoCssRulesBorrowed")
130         .blocklist_type("ServoCssRulesBorrowedOrNull")
131         .blocklist_type("ServoCssRules")
132         .blocklist_type("RawServoStyleSheetStrong")
133         .blocklist_type("RawServoStyleSheetBorrowed")
134         .blocklist_type("RawServoStyleSheetBorrowedOrNull")
135         .blocklist_type("RawServoStyleSheet")
136         .blocklist_type("ServoComputedValuesStrong")
137         .blocklist_type("ServoComputedValuesBorrowed")
138         .blocklist_type("ServoComputedValuesBorrowedOrNull")
139         .blocklist_type("ServoComputedValues")
140         .blocklist_type("RawServoDeclarationBlockStrong")
141         .blocklist_type("RawServoDeclarationBlockBorrowed")
142         .blocklist_type("RawServoDeclarationBlockBorrowedOrNull")
143         .blocklist_type("RawServoStyleRuleStrong")
144         .blocklist_type("RawServoStyleRuleBorrowed")
145         .blocklist_type("RawServoStyleRuleBorrowedOrNull")
146         .blocklist_type("RawServoStyleRule")
147         .blocklist_type("RawServoImportRuleStrong")
148         .blocklist_type("RawServoImportRuleBorrowed")
149         .blocklist_type("RawServoImportRuleBorrowedOrNull")
150         .blocklist_type("RawServoImportRule")
151         .blocklist_type("RawServoAnimationValueStrong")
152         .blocklist_type("RawServoAnimationValueBorrowed")
153         .blocklist_type("RawServoAnimationValueBorrowedOrNull")
154         .blocklist_type("RawServoAnimationValueMapStrong")
155         .blocklist_type("RawServoAnimationValueMapBorrowed")
156         .blocklist_type("RawServoAnimationValueMapBorrowedOrNull")
157         .blocklist_type("RawServoMediaListStrong")
158         .blocklist_type("RawServoMediaListBorrowed")
159         .blocklist_type("RawServoMediaListBorrowedOrNull")
160         .blocklist_type("RawServoMediaList")
161         .blocklist_type("RawServoMediaRuleStrong")
162         .blocklist_type("RawServoMediaRuleBorrowed")
163         .blocklist_type("RawServoMediaRuleBorrowedOrNull")
164         .blocklist_type("RawServoMediaRule")
165         .blocklist_type("RawServoNamespaceRuleStrong")
166         .blocklist_type("RawServoNamespaceRuleBorrowed")
167         .blocklist_type("RawServoNamespaceRuleBorrowedOrNull")
168         .blocklist_type("RawServoNamespaceRule")
169         .blocklist_type("RawServoStyleSetOwned")
170         .blocklist_type("RawServoStyleSetOwnedOrNull")
171         .blocklist_type("RawServoStyleSetBorrowed")
172         .blocklist_type("RawServoStyleSetBorrowedOrNull")
173         .blocklist_type("RawServoStyleSetBorrowedMut")
174         .blocklist_type("RawServoStyleSetBorrowedMutOrNull")
175         .blocklist_type("RawServoStyleSet")
176         .blocklist_type("StyleChildrenIteratorOwned")
177         .blocklist_type("StyleChildrenIteratorOwnedOrNull")
178         .blocklist_type("StyleChildrenIteratorBorrowed")
179         .blocklist_type("StyleChildrenIteratorBorrowedOrNull")
180         .blocklist_type("StyleChildrenIteratorBorrowedMut")
181         .blocklist_type("StyleChildrenIteratorBorrowedMutOrNull")
182         .blocklist_type("StyleChildrenIterator")
183         .blocklist_type("ServoElementSnapshotOwned")
184         .blocklist_type("ServoElementSnapshotOwnedOrNull")
185         .blocklist_type("ServoElementSnapshotBorrowed")
186         .blocklist_type("ServoElementSnapshotBorrowedOrNull")
187         .blocklist_type("ServoElementSnapshotBorrowedMut")
188         .blocklist_type("ServoElementSnapshotBorrowedMutOrNull")
189         .blocklist_type("RawGeckoNodeBorrowed")
190         .blocklist_type("RawGeckoNodeBorrowedOrNull")
191         .blocklist_type("RawGeckoElementBorrowed")
192         .blocklist_type("RawGeckoElementBorrowedOrNull")
193         .blocklist_type("RawGeckoDocumentBorrowed")
194         .blocklist_type("RawGeckoDocumentBorrowedOrNull")
195         .blocklist_type("RawServoDeclarationBlockStrongBorrowed")
196         .blocklist_type("RawServoDeclarationBlockStrongBorrowedOrNull")
197         .blocklist_type("RawGeckoPresContextBorrowed")
198         .blocklist_type("RawGeckoPresContextBorrowedOrNull")
199         .blocklist_type("RawGeckoStyleAnimationListBorrowed")
200         .blocklist_type("RawGeckoStyleAnimationListBorrowedOrNull")
201         .blocklist_type("nsCSSValueBorrowed")
202         .blocklist_type("nsCSSValueBorrowedOrNull")
203         .blocklist_type("nsCSSValueBorrowedMut")
204         .blocklist_type("nsCSSValueBorrowedMutOrNull")
205         .blocklist_type("nsTimingFunctionBorrowed")
206         .blocklist_type("nsTimingFunctionBorrowedOrNull")
207         .blocklist_type("nsTimingFunctionBorrowedMut")
208         .blocklist_type("nsTimingFunctionBorrowedMutOrNull")
209         .blocklist_type("RawGeckoAnimationPropertySegmentBorrowed")
210         .blocklist_type("RawGeckoAnimationPropertySegmentBorrowedOrNull")
211         .blocklist_type("RawGeckoAnimationPropertySegmentBorrowedMut")
212         .blocklist_type("RawGeckoAnimationPropertySegmentBorrowedMutOrNull")
213         .blocklist_type("RawGeckoAnimationValueListBorrowed")
214         .blocklist_type("RawGeckoAnimationValueListBorrowedOrNull")
215         .blocklist_type("RawGeckoAnimationValueListBorrowedMut")
216         .blocklist_type("RawGeckoAnimationValueListBorrowedMutOrNull")
217         .blocklist_type("RawGeckoComputedTimingBorrowed")
218         .blocklist_type("RawGeckoComputedTimingBorrowedOrNull")
219         .blocklist_type("RawGeckoComputedTimingBorrowedMut")
220         .blocklist_type("RawGeckoComputedTimingBorrowedMutOrNull")
221         .blocklist_type("RawGeckoKeyframeListBorrowed")
222         .blocklist_type("RawGeckoKeyframeListBorrowedOrNull")
223         .blocklist_type("RawGeckoKeyframeListBorrowedMut")
224         .blocklist_type("RawGeckoKeyframeListBorrowedMutOrNull")
225         .blocklist_type("RawGeckoComputedKeyframeValuesListBorrowed")
226         .blocklist_type("RawGeckoComputedKeyframeValuesListBorrowedOrNull")
227         .blocklist_type("RawGeckoComputedKeyframeValuesListBorrowedMut")
228         .blocklist_type("RawGeckoComputedKeyframeValuesListBorrowedMutOrNull")
229         .blocklist_type("RawGeckoFontFaceRuleListBorrowed")
230         .blocklist_type("RawGeckoFontFaceRuleListBorrowedOrNull")
231         .blocklist_type("RawGeckoFontFaceRuleListBorrowedMut")
232         .blocklist_type("RawGeckoFontFaceRuleListBorrowedMutOrNull")
233         .raw_line(r#"pub use nsstring::{nsACString, nsAString, nsString};"#)
234         .raw_line(r#"type nsACString_internal = nsACString;"#)
235         .raw_line(r#"type nsAString_internal = nsAString;"#)
236         .raw_line(r#"use gecko_bindings::structs::mozilla::css::URLValue;"#)
237         .raw_line(r#"use gecko_bindings::structs::RawGeckoAnimationPropertySegment;"#)
238         .raw_line(r#"use gecko_bindings::structs::RawGeckoComputedTiming;"#)
239         .raw_line(r#"use gecko_bindings::structs::RawGeckoDocument;"#)
240         .raw_line(r#"use gecko_bindings::structs::RawGeckoElement;"#)
241         .raw_line(r#"use gecko_bindings::structs::RawGeckoKeyframeList;"#)
242         .raw_line(r#"use gecko_bindings::structs::RawGeckoComputedKeyframeValuesList;"#)
243         .raw_line(r#"use gecko_bindings::structs::RawGeckoFontFaceRuleList;"#)
244         .raw_line(r#"use gecko_bindings::structs::RawGeckoNode;"#)
245         .raw_line(r#"use gecko_bindings::structs::RawGeckoAnimationValueList;"#)
246         .raw_line(r#"use gecko_bindings::structs::RawServoAnimationValue;"#)
247         .raw_line(r#"use gecko_bindings::structs::RawServoAnimationValueMap;"#)
248         .raw_line(r#"use gecko_bindings::structs::RawServoDeclarationBlock;"#)
249         .raw_line(r#"use gecko_bindings::structs::RawGeckoPresContext;"#)
250         .raw_line(r#"use gecko_bindings::structs::RawGeckoPresContextOwned;"#)
251         .raw_line(r#"use gecko_bindings::structs::RawGeckoStyleAnimationList;"#)
252         .raw_line(r#"use gecko_bindings::structs::RawGeckoURLExtraData;"#)
253         .raw_line(r#"use gecko_bindings::structs::RefPtr;"#)
254         .raw_line(r#"use gecko_bindings::structs::CSSPseudoClassType;"#)
255         .raw_line(r#"use gecko_bindings::structs::TraversalRootBehavior;"#)
256         .raw_line(r#"use gecko_bindings::structs::ComputedTimingFunction_BeforeFlag;"#)
257         .raw_line(r#"use gecko_bindings::structs::FontFamilyList;"#)
258         .raw_line(r#"use gecko_bindings::structs::FontFamilyType;"#)
259         .raw_line(r#"use gecko_bindings::structs::Keyframe;"#)
260         .raw_line(r#"use gecko_bindings::structs::ServoBundledURI;"#)
261         .raw_line(r#"use gecko_bindings::structs::ServoElementSnapshot;"#)
262         .raw_line(r#"use gecko_bindings::structs::SheetParsingMode;"#)
263         .raw_line(r#"use gecko_bindings::structs::StyleBasicShape;"#)
264         .raw_line(r#"use gecko_bindings::structs::StyleBasicShapeType;"#)
265         .raw_line(r#"use gecko_bindings::structs::StyleShapeSource;"#)
266         .raw_line(r#"use gecko_bindings::structs::nsCSSFontFaceRule;"#)
267         .raw_line(r#"use gecko_bindings::structs::nsCSSKeyword;"#)
268         .raw_line(r#"use gecko_bindings::structs::nsCSSPropertyID;"#)
269         .raw_line(r#"use gecko_bindings::structs::nsCSSShadowArray;"#)
270         .raw_line(r#"use gecko_bindings::structs::nsCSSUnit;"#)
271         .raw_line(r#"use gecko_bindings::structs::nsCSSValue;"#)
272         .raw_line(r#"use gecko_bindings::structs::nsCSSValueSharedList;"#)
273         .raw_line(r#"use gecko_bindings::structs::nsChangeHint;"#)
274         .raw_line(r#"use gecko_bindings::structs::nsCursorImage;"#)
275         .raw_line(r#"use gecko_bindings::structs::nsFont;"#)
276         .raw_line(r#"use gecko_bindings::structs::nsIAtom;"#)
277         .raw_line(r#"use gecko_bindings::structs::nsMediaFeature;"#)
278         .raw_line(r#"use gecko_bindings::structs::nsRestyleHint;"#)
279         .raw_line(r#"use gecko_bindings::structs::nsStyleBackground;"#)
280         .raw_line(r#"unsafe impl Send for nsStyleBackground {}"#)
281         .raw_line(r#"unsafe impl Sync for nsStyleBackground {}"#)
282         .raw_line(r#"use gecko_bindings::structs::nsStyleBorder;"#)
283         .raw_line(r#"unsafe impl Send for nsStyleBorder {}"#)
284         .raw_line(r#"unsafe impl Sync for nsStyleBorder {}"#)
285         .raw_line(r#"use gecko_bindings::structs::nsStyleColor;"#)
286         .raw_line(r#"unsafe impl Send for nsStyleColor {}"#)
287         .raw_line(r#"unsafe impl Sync for nsStyleColor {}"#)
288         .raw_line(r#"use gecko_bindings::structs::nsStyleColumn;"#)
289         .raw_line(r#"unsafe impl Send for nsStyleColumn {}"#)
290         .raw_line(r#"unsafe impl Sync for nsStyleColumn {}"#)
291         .raw_line(r#"use gecko_bindings::structs::nsStyleContent;"#)
292         .raw_line(r#"unsafe impl Send for nsStyleContent {}"#)
293         .raw_line(r#"unsafe impl Sync for nsStyleContent {}"#)
294         .raw_line(r#"use gecko_bindings::structs::nsStyleContentData;"#)
295         .raw_line(r#"unsafe impl Send for nsStyleContentData {}"#)
296         .raw_line(r#"unsafe impl Sync for nsStyleContentData {}"#)
297         .raw_line(r#"use gecko_bindings::structs::nsStyleContentType;"#)
298         .raw_line(r#"unsafe impl Send for nsStyleContentType {}"#)
299         .raw_line(r#"unsafe impl Sync for nsStyleContentType {}"#)
300         .raw_line(r#"use gecko_bindings::structs::nsStyleContext;"#)
301         .raw_line(r#"unsafe impl Send for nsStyleContext {}"#)
302         .raw_line(r#"unsafe impl Sync for nsStyleContext {}"#)
303         .raw_line(r#"use gecko_bindings::structs::nsStyleCoord;"#)
304         .raw_line(r#"unsafe impl Send for nsStyleCoord {}"#)
305         .raw_line(r#"unsafe impl Sync for nsStyleCoord {}"#)
306         .raw_line(r#"use gecko_bindings::structs::nsStyleCoord_Calc;"#)
307         .raw_line(r#"unsafe impl Send for nsStyleCoord_Calc {}"#)
308         .raw_line(r#"unsafe impl Sync for nsStyleCoord_Calc {}"#)
309         .raw_line(r#"use gecko_bindings::structs::nsStyleCoord_CalcValue;"#)
310         .raw_line(r#"unsafe impl Send for nsStyleCoord_CalcValue {}"#)
311         .raw_line(r#"unsafe impl Sync for nsStyleCoord_CalcValue {}"#)
312         .raw_line(r#"use gecko_bindings::structs::nsStyleDisplay;"#)
313         .raw_line(r#"unsafe impl Send for nsStyleDisplay {}"#)
314         .raw_line(r#"unsafe impl Sync for nsStyleDisplay {}"#)
315         .raw_line(r#"use gecko_bindings::structs::nsStyleEffects;"#)
316         .raw_line(r#"unsafe impl Send for nsStyleEffects {}"#)
317         .raw_line(r#"unsafe impl Sync for nsStyleEffects {}"#)
318         .raw_line(r#"use gecko_bindings::structs::nsStyleFilter;"#)
319         .raw_line(r#"unsafe impl Send for nsStyleFilter {}"#)
320         .raw_line(r#"unsafe impl Sync for nsStyleFilter {}"#)
321         .raw_line(r#"use gecko_bindings::structs::nsStyleFont;"#)
322         .raw_line(r#"unsafe impl Send for nsStyleFont {}"#)
323         .raw_line(r#"unsafe impl Sync for nsStyleFont {}"#)
324         .raw_line(r#"use gecko_bindings::structs::nsStyleGradient;"#)
325         .raw_line(r#"unsafe impl Send for nsStyleGradient {}"#)
326         .raw_line(r#"unsafe impl Sync for nsStyleGradient {}"#)
327         .raw_line(r#"use gecko_bindings::structs::nsStyleGradientStop;"#)
328         .raw_line(r#"unsafe impl Send for nsStyleGradientStop {}"#)
329         .raw_line(r#"unsafe impl Sync for nsStyleGradientStop {}"#)
330         .raw_line(r#"use gecko_bindings::structs::nsStyleImage;"#)
331         .raw_line(r#"unsafe impl Send for nsStyleImage {}"#)
332         .raw_line(r#"unsafe impl Sync for nsStyleImage {}"#)
333         .raw_line(r#"use gecko_bindings::structs::nsStyleImageLayers;"#)
334         .raw_line(r#"unsafe impl Send for nsStyleImageLayers {}"#)
335         .raw_line(r#"unsafe impl Sync for nsStyleImageLayers {}"#)
336         .raw_line(r#"use gecko_bindings::structs::nsStyleImageLayers_Layer;"#)
337         .raw_line(r#"unsafe impl Send for nsStyleImageLayers_Layer {}"#)
338         .raw_line(r#"unsafe impl Sync for nsStyleImageLayers_Layer {}"#)
339         .raw_line(r#"use gecko_bindings::structs::nsStyleImageLayers_LayerType;"#)
340         .raw_line(r#"unsafe impl Send for nsStyleImageLayers_LayerType {}"#)
341         .raw_line(r#"unsafe impl Sync for nsStyleImageLayers_LayerType {}"#)
342         .raw_line(r#"use gecko_bindings::structs::nsStyleImageRequest;"#)
343         .raw_line(r#"unsafe impl Send for nsStyleImageRequest {}"#)
344         .raw_line(r#"unsafe impl Sync for nsStyleImageRequest {}"#)
345         .raw_line(r#"use gecko_bindings::structs::nsStyleList;"#)
346         .raw_line(r#"unsafe impl Send for nsStyleList {}"#)
347         .raw_line(r#"unsafe impl Sync for nsStyleList {}"#)
348         .raw_line(r#"use gecko_bindings::structs::nsStyleMargin;"#)
349         .raw_line(r#"unsafe impl Send for nsStyleMargin {}"#)
350         .raw_line(r#"unsafe impl Sync for nsStyleMargin {}"#)
351         .raw_line(r#"use gecko_bindings::structs::nsStyleOutline;"#)
352         .raw_line(r#"unsafe impl Send for nsStyleOutline {}"#)
353         .raw_line(r#"unsafe impl Sync for nsStyleOutline {}"#)
354         .raw_line(r#"use gecko_bindings::structs::nsStylePadding;"#)
355         .raw_line(r#"unsafe impl Send for nsStylePadding {}"#)
356         .raw_line(r#"unsafe impl Sync for nsStylePadding {}"#)
357         .raw_line(r#"use gecko_bindings::structs::nsStylePosition;"#)
358         .raw_line(r#"unsafe impl Send for nsStylePosition {}"#)
359         .raw_line(r#"unsafe impl Sync for nsStylePosition {}"#)
360         .raw_line(r#"use gecko_bindings::structs::nsStyleQuoteValues;"#)
361         .raw_line(r#"unsafe impl Send for nsStyleQuoteValues {}"#)
362         .raw_line(r#"unsafe impl Sync for nsStyleQuoteValues {}"#)
363         .raw_line(r#"use gecko_bindings::structs::nsStyleSVG;"#)
364         .raw_line(r#"unsafe impl Send for nsStyleSVG {}"#)
365         .raw_line(r#"unsafe impl Sync for nsStyleSVG {}"#)
366         .raw_line(r#"use gecko_bindings::structs::nsStyleSVGPaint;"#)
367         .raw_line(r#"unsafe impl Send for nsStyleSVGPaint {}"#)
368         .raw_line(r#"unsafe impl Sync for nsStyleSVGPaint {}"#)
369         .raw_line(r#"use gecko_bindings::structs::nsStyleSVGReset;"#)
370         .raw_line(r#"unsafe impl Send for nsStyleSVGReset {}"#)
371         .raw_line(r#"unsafe impl Sync for nsStyleSVGReset {}"#)
372         .raw_line(r#"use gecko_bindings::structs::nsStyleTable;"#)
373         .raw_line(r#"unsafe impl Send for nsStyleTable {}"#)
374         .raw_line(r#"unsafe impl Sync for nsStyleTable {}"#)
375         .raw_line(r#"use gecko_bindings::structs::nsStyleTableBorder;"#)
376         .raw_line(r#"unsafe impl Send for nsStyleTableBorder {}"#)
377         .raw_line(r#"unsafe impl Sync for nsStyleTableBorder {}"#)
378         .raw_line(r#"use gecko_bindings::structs::nsStyleText;"#)
379         .raw_line(r#"unsafe impl Send for nsStyleText {}"#)
380         .raw_line(r#"unsafe impl Sync for nsStyleText {}"#)
381         .raw_line(r#"use gecko_bindings::structs::nsStyleTextReset;"#)
382         .raw_line(r#"unsafe impl Send for nsStyleTextReset {}"#)
383         .raw_line(r#"unsafe impl Sync for nsStyleTextReset {}"#)
384         .raw_line(r#"use gecko_bindings::structs::nsStyleUIReset;"#)
385         .raw_line(r#"unsafe impl Send for nsStyleUIReset {}"#)
386         .raw_line(r#"unsafe impl Sync for nsStyleUIReset {}"#)
387         .raw_line(r#"use gecko_bindings::structs::nsStyleUnion;"#)
388         .raw_line(r#"unsafe impl Send for nsStyleUnion {}"#)
389         .raw_line(r#"unsafe impl Sync for nsStyleUnion {}"#)
390         .raw_line(r#"use gecko_bindings::structs::nsStyleUnit;"#)
391         .raw_line(r#"unsafe impl Send for nsStyleUnit {}"#)
392         .raw_line(r#"unsafe impl Sync for nsStyleUnit {}"#)
393         .raw_line(r#"use gecko_bindings::structs::nsStyleUserInterface;"#)
394         .raw_line(r#"unsafe impl Send for nsStyleUserInterface {}"#)
395         .raw_line(r#"unsafe impl Sync for nsStyleUserInterface {}"#)
396         .raw_line(r#"use gecko_bindings::structs::nsStyleVariables;"#)
397         .raw_line(r#"unsafe impl Send for nsStyleVariables {}"#)
398         .raw_line(r#"unsafe impl Sync for nsStyleVariables {}"#)
399         .raw_line(r#"use gecko_bindings::structs::nsStyleVisibility;"#)
400         .raw_line(r#"unsafe impl Send for nsStyleVisibility {}"#)
401         .raw_line(r#"unsafe impl Sync for nsStyleVisibility {}"#)
402         .raw_line(r#"use gecko_bindings::structs::nsStyleXUL;"#)
403         .raw_line(r#"unsafe impl Send for nsStyleXUL {}"#)
404         .raw_line(r#"unsafe impl Sync for nsStyleXUL {}"#)
405         .raw_line(r#"use gecko_bindings::structs::nsTimingFunction;"#)
406         .raw_line(r#"use gecko_bindings::structs::nscolor;"#)
407         .raw_line(r#"use gecko_bindings::structs::nscoord;"#)
408         .raw_line(r#"use gecko_bindings::structs::nsresult;"#)
409         .raw_line(r#"use gecko_bindings::structs::Loader;"#)
410         .raw_line(r#"use gecko_bindings::structs::ServoStyleSheet;"#)
411         .raw_line(r#"use gecko_bindings::structs::EffectCompositor_CascadeLevel;"#)
412         .raw_line(r#"use gecko_bindings::structs::UpdateAnimationsTasks;"#)
413         .raw_line(r#"pub type nsTArrayBorrowed_uintptr_t<'a> = &'a mut ::gecko_bindings::structs::nsTArray<usize>;"#)
414         .raw_line(r#"pub type ServoCssRulesStrong = ::gecko_bindings::sugar::ownership::Strong<ServoCssRules>;"#)
415         .raw_line(r#"pub type ServoCssRulesBorrowed<'a> = &'a ServoCssRules;"#)
416         .raw_line(r#"pub type ServoCssRulesBorrowedOrNull<'a> = Option<&'a ServoCssRules>;"#)
417         .raw_line(r#"enum ServoCssRulesVoid { }"#)
418         .raw_line(r#"pub struct ServoCssRules(ServoCssRulesVoid);"#)
419         .raw_line(r#"pub type RawServoStyleSheetStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoStyleSheet>;"#)
420         .raw_line(r#"pub type RawServoStyleSheetBorrowed<'a> = &'a RawServoStyleSheet;"#)
421         .raw_line(r#"pub type RawServoStyleSheetBorrowedOrNull<'a> = Option<&'a RawServoStyleSheet>;"#)
422         .raw_line(r#"enum RawServoStyleSheetVoid { }"#)
423         .raw_line(r#"pub struct RawServoStyleSheet(RawServoStyleSheetVoid);"#)
424         .raw_line(r#"pub type ServoComputedValuesStrong = ::gecko_bindings::sugar::ownership::Strong<ServoComputedValues>;"#)
425         .raw_line(r#"pub type ServoComputedValuesBorrowed<'a> = &'a ServoComputedValues;"#)
426         .raw_line(r#"pub type ServoComputedValuesBorrowedOrNull<'a> = Option<&'a ServoComputedValues>;"#)
427         .raw_line(r#"enum ServoComputedValuesVoid { }"#)
428         .raw_line(r#"pub struct ServoComputedValues(ServoComputedValuesVoid);"#)
429         .raw_line(r#"pub type RawServoDeclarationBlockStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoDeclarationBlock>;"#)
430         .raw_line(r#"pub type RawServoDeclarationBlockBorrowed<'a> = &'a RawServoDeclarationBlock;"#)
431         .raw_line(r#"pub type RawServoDeclarationBlockBorrowedOrNull<'a> = Option<&'a RawServoDeclarationBlock>;"#)
432         .raw_line(r#"pub type RawServoStyleRuleStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoStyleRule>;"#)
433         .raw_line(r#"pub type RawServoStyleRuleBorrowed<'a> = &'a RawServoStyleRule;"#)
434         .raw_line(r#"pub type RawServoStyleRuleBorrowedOrNull<'a> = Option<&'a RawServoStyleRule>;"#)
435         .raw_line(r#"enum RawServoStyleRuleVoid { }"#)
436         .raw_line(r#"pub struct RawServoStyleRule(RawServoStyleRuleVoid);"#)
437         .raw_line(r#"pub type RawServoImportRuleStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoImportRule>;"#)
438         .raw_line(r#"pub type RawServoImportRuleBorrowed<'a> = &'a RawServoImportRule;"#)
439         .raw_line(r#"pub type RawServoImportRuleBorrowedOrNull<'a> = Option<&'a RawServoImportRule>;"#)
440         .raw_line(r#"enum RawServoImportRuleVoid { }"#)
441         .raw_line(r#"pub struct RawServoImportRule(RawServoImportRuleVoid);"#)
442         .raw_line(r#"pub type RawServoAnimationValueStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoAnimationValue>;"#)
443         .raw_line(r#"pub type RawServoAnimationValueBorrowed<'a> = &'a RawServoAnimationValue;"#)
444         .raw_line(r#"pub type RawServoAnimationValueBorrowedOrNull<'a> = Option<&'a RawServoAnimationValue>;"#)
445         .raw_line(r#"pub type RawServoAnimationValueMapStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoAnimationValueMap>;"#)
446         .raw_line(r#"pub type RawServoAnimationValueMapBorrowed<'a> = &'a RawServoAnimationValueMap;"#)
447         .raw_line(r#"pub type RawServoAnimationValueMapBorrowedOrNull<'a> = Option<&'a RawServoAnimationValueMap>;"#)
448         .raw_line(r#"pub type RawServoMediaListStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoMediaList>;"#)
449         .raw_line(r#"pub type RawServoMediaListBorrowed<'a> = &'a RawServoMediaList;"#)
450         .raw_line(r#"pub type RawServoMediaListBorrowedOrNull<'a> = Option<&'a RawServoMediaList>;"#)
451         .raw_line(r#"enum RawServoMediaListVoid { }"#)
452         .raw_line(r#"pub struct RawServoMediaList(RawServoMediaListVoid);"#)
453         .raw_line(r#"pub type RawServoMediaRuleStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoMediaRule>;"#)
454         .raw_line(r#"pub type RawServoMediaRuleBorrowed<'a> = &'a RawServoMediaRule;"#)
455         .raw_line(r#"pub type RawServoMediaRuleBorrowedOrNull<'a> = Option<&'a RawServoMediaRule>;"#)
456         .raw_line(r#"enum RawServoMediaRuleVoid { }"#)
457         .raw_line(r#"pub struct RawServoMediaRule(RawServoMediaRuleVoid);"#)
458         .raw_line(r#"pub type RawServoNamespaceRuleStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoNamespaceRule>;"#)
459         .raw_line(r#"pub type RawServoNamespaceRuleBorrowed<'a> = &'a RawServoNamespaceRule;"#)
460         .raw_line(r#"pub type RawServoNamespaceRuleBorrowedOrNull<'a> = Option<&'a RawServoNamespaceRule>;"#)
461         .raw_line(r#"enum RawServoNamespaceRuleVoid { }"#)
462         .raw_line(r#"pub struct RawServoNamespaceRule(RawServoNamespaceRuleVoid);"#)
463         .raw_line(r#"pub type RawServoStyleSetOwned = ::gecko_bindings::sugar::ownership::Owned<RawServoStyleSet>;"#)
464         .raw_line(r#"pub type RawServoStyleSetOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<RawServoStyleSet>;"#)
465         .raw_line(r#"pub type RawServoStyleSetBorrowed<'a> = &'a RawServoStyleSet;"#)
466         .raw_line(r#"pub type RawServoStyleSetBorrowedOrNull<'a> = Option<&'a RawServoStyleSet>;"#)
467         .raw_line(r#"pub type RawServoStyleSetBorrowedMut<'a> = &'a mut RawServoStyleSet;"#)
468         .raw_line(r#"pub type RawServoStyleSetBorrowedMutOrNull<'a> = Option<&'a mut RawServoStyleSet>;"#)
469         .raw_line(r#"enum RawServoStyleSetVoid { }"#)
470         .raw_line(r#"pub struct RawServoStyleSet(RawServoStyleSetVoid);"#)
471         .raw_line(r#"pub type StyleChildrenIteratorOwned = ::gecko_bindings::sugar::ownership::Owned<StyleChildrenIterator>;"#)
472         .raw_line(r#"pub type StyleChildrenIteratorOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<StyleChildrenIterator>;"#)
473         .raw_line(r#"pub type StyleChildrenIteratorBorrowed<'a> = &'a StyleChildrenIterator;"#)
474         .raw_line(r#"pub type StyleChildrenIteratorBorrowedOrNull<'a> = Option<&'a StyleChildrenIterator>;"#)
475         .raw_line(r#"pub type StyleChildrenIteratorBorrowedMut<'a> = &'a mut StyleChildrenIterator;"#)
476         .raw_line(r#"pub type StyleChildrenIteratorBorrowedMutOrNull<'a> = Option<&'a mut StyleChildrenIterator>;"#)
477         .raw_line(r#"enum StyleChildrenIteratorVoid { }"#)
478         .raw_line(r#"pub struct StyleChildrenIterator(StyleChildrenIteratorVoid);"#)
479         .raw_line(r#"pub type ServoElementSnapshotOwned = ::gecko_bindings::sugar::ownership::Owned<ServoElementSnapshot>;"#)
480         .raw_line(r#"pub type ServoElementSnapshotOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<ServoElementSnapshot>;"#)
481         .raw_line(r#"pub type ServoElementSnapshotBorrowed<'a> = &'a ServoElementSnapshot;"#)
482         .raw_line(r#"pub type ServoElementSnapshotBorrowedOrNull<'a> = Option<&'a ServoElementSnapshot>;"#)
483         .raw_line(r#"pub type ServoElementSnapshotBorrowedMut<'a> = &'a mut ServoElementSnapshot;"#)
484         .raw_line(r#"pub type ServoElementSnapshotBorrowedMutOrNull<'a> = Option<&'a mut ServoElementSnapshot>;"#)
485         .raw_line(r#"pub type RawGeckoNodeBorrowed<'a> = &'a RawGeckoNode;"#)
486         .raw_line(r#"pub type RawGeckoNodeBorrowedOrNull<'a> = Option<&'a RawGeckoNode>;"#)
487         .raw_line(r#"pub type RawGeckoElementBorrowed<'a> = &'a RawGeckoElement;"#)
488         .raw_line(r#"pub type RawGeckoElementBorrowedOrNull<'a> = Option<&'a RawGeckoElement>;"#)
489         .raw_line(r#"pub type RawGeckoDocumentBorrowed<'a> = &'a RawGeckoDocument;"#)
490         .raw_line(r#"pub type RawGeckoDocumentBorrowedOrNull<'a> = Option<&'a RawGeckoDocument>;"#)
491         .raw_line(r#"pub type RawServoDeclarationBlockStrongBorrowed<'a> = &'a RawServoDeclarationBlockStrong;"#)
492         .raw_line(r#"pub type RawServoDeclarationBlockStrongBorrowedOrNull<'a> = Option<&'a RawServoDeclarationBlockStrong>;"#)
493         .raw_line(r#"pub type RawGeckoPresContextBorrowed<'a> = &'a RawGeckoPresContext;"#)
494         .raw_line(r#"pub type RawGeckoPresContextBorrowedOrNull<'a> = Option<&'a RawGeckoPresContext>;"#)
495         .raw_line(r#"pub type RawGeckoStyleAnimationListBorrowed<'a> = &'a RawGeckoStyleAnimationList;"#)
496         .raw_line(r#"pub type RawGeckoStyleAnimationListBorrowedOrNull<'a> = Option<&'a RawGeckoStyleAnimationList>;"#)
497         .raw_line(r#"pub type nsCSSValueBorrowed<'a> = &'a nsCSSValue;"#)
498         .raw_line(r#"pub type nsCSSValueBorrowedOrNull<'a> = Option<&'a nsCSSValue>;"#)
499         .raw_line(r#"pub type nsCSSValueBorrowedMut<'a> = &'a mut nsCSSValue;"#)
500         .raw_line(r#"pub type nsCSSValueBorrowedMutOrNull<'a> = Option<&'a mut nsCSSValue>;"#)
501         .raw_line(r#"pub type nsTimingFunctionBorrowed<'a> = &'a nsTimingFunction;"#)
502         .raw_line(r#"pub type nsTimingFunctionBorrowedOrNull<'a> = Option<&'a nsTimingFunction>;"#)
503         .raw_line(r#"pub type nsTimingFunctionBorrowedMut<'a> = &'a mut nsTimingFunction;"#)
504         .raw_line(r#"pub type nsTimingFunctionBorrowedMutOrNull<'a> = Option<&'a mut nsTimingFunction>;"#)
505         .raw_line(r#"pub type RawGeckoAnimationPropertySegmentBorrowed<'a> = &'a RawGeckoAnimationPropertySegment;"#)
506         .raw_line(r#"pub type RawGeckoAnimationPropertySegmentBorrowedOrNull<'a> = Option<&'a RawGeckoAnimationPropertySegment>;"#)
507         .raw_line(r#"pub type RawGeckoAnimationPropertySegmentBorrowedMut<'a> = &'a mut RawGeckoAnimationPropertySegment;"#)
508         .raw_line(r#"pub type RawGeckoAnimationPropertySegmentBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoAnimationPropertySegment>;"#)
509         .raw_line(r#"pub type RawGeckoAnimationValueListBorrowed<'a> = &'a RawGeckoAnimationValueList;"#)
510         .raw_line(r#"pub type RawGeckoAnimationValueListBorrowedOrNull<'a> = Option<&'a RawGeckoAnimationValueList>;"#)
511         .raw_line(r#"pub type RawGeckoAnimationValueListBorrowedMut<'a> = &'a mut RawGeckoAnimationValueList;"#)
512         .raw_line(r#"pub type RawGeckoAnimationValueListBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoAnimationValueList>;"#)
513         .raw_line(r#"pub type RawGeckoComputedTimingBorrowed<'a> = &'a RawGeckoComputedTiming;"#)
514         .raw_line(r#"pub type RawGeckoComputedTimingBorrowedOrNull<'a> = Option<&'a RawGeckoComputedTiming>;"#)
515         .raw_line(r#"pub type RawGeckoComputedTimingBorrowedMut<'a> = &'a mut RawGeckoComputedTiming;"#)
516         .raw_line(r#"pub type RawGeckoComputedTimingBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoComputedTiming>;"#)
517         .raw_line(r#"pub type RawGeckoKeyframeListBorrowed<'a> = &'a RawGeckoKeyframeList;"#)
518         .raw_line(r#"pub type RawGeckoKeyframeListBorrowedOrNull<'a> = Option<&'a RawGeckoKeyframeList>;"#)
519         .raw_line(r#"pub type RawGeckoKeyframeListBorrowedMut<'a> = &'a mut RawGeckoKeyframeList;"#)
520         .raw_line(r#"pub type RawGeckoKeyframeListBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoKeyframeList>;"#)
521         .raw_line(r#"pub type RawGeckoComputedKeyframeValuesListBorrowed<'a> = &'a RawGeckoComputedKeyframeValuesList;"#)
522         .raw_line(r#"pub type RawGeckoComputedKeyframeValuesListBorrowedOrNull<'a> = Option<&'a RawGeckoComputedKeyframeValuesList>;"#)
523         .raw_line(r#"pub type RawGeckoComputedKeyframeValuesListBorrowedMut<'a> = &'a mut RawGeckoComputedKeyframeValuesList;"#)
524         .raw_line(r#"pub type RawGeckoComputedKeyframeValuesListBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoComputedKeyframeValuesList>;"#)
525         .raw_line(r#"pub type RawGeckoFontFaceRuleListBorrowed<'a> = &'a RawGeckoFontFaceRuleList;"#)
526         .raw_line(r#"pub type RawGeckoFontFaceRuleListBorrowedOrNull<'a> = Option<&'a RawGeckoFontFaceRuleList>;"#)
527         .raw_line(r#"pub type RawGeckoFontFaceRuleListBorrowedMut<'a> = &'a mut RawGeckoFontFaceRuleList;"#)
528         .raw_line(r#"pub type RawGeckoFontFaceRuleListBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoFontFaceRuleList>;"#)
529         .clang_arg("-x")
530         .clang_arg("c++")
531         .clang_arg("-std=c++14")
532         .clang_arg("-DTRACING=1")
533         .clang_arg("-DIMPL_LIBXUL")
534         .clang_arg("-DMOZ_STYLO_BINDINGS=1")
535         .clang_arg("-DMOZILLA_INTERNAL_API")
536         .clang_arg("-DRUST_BINDGEN")
537         .clang_arg("-DMOZ_STYLO")
538         .clang_arg("-DOS_POSIX=1")
539         .clang_arg("-DOS_LINUX=1")
540         .generate()
541         .expect("Should generate stylo bindings");
542 
543     let now = Instant::now();
544 
545     println!();
546     println!();
547     println!(
548         "Generated Stylo bindings in: {:?}",
549         now.duration_since(then)
550     );
551     println!();
552     println!();
553 
554     // panic!("Uncomment this line to get timing logs");
555 }
556