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