Bug 1397937 - Prune unused FFI types with Linux 32-bit issues. r=emilio draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Thu, 07 Sep 2017 18:00:43 -0500
changeset 661119 a8839a2aa29516a0d163aa765be985b16aa2d771
parent 660378 45084f5718b924ffcbd6a791cf3607546c47befb
child 730453 cfe3708df1f68bf97c7ba78e031486fd90b4e92c
push id78632
push userbmo:jryans@gmail.com
push dateThu, 07 Sep 2017 23:09:45 +0000
reviewersemilio
bugs1397937
milestone57.0a1
Bug 1397937 - Prune unused FFI types with Linux 32-bit issues. r=emilio MozReview-Commit-ID: 26UmO9RcGQm
layout/style/ServoBindings.toml
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -82,16 +82,28 @@ raw-lines = [
     "pub use self::root::mozilla::dom::*;",
     "use atomic_refcell::AtomicRefCell;",
     "use data::ElementData;",
 ]
 hide-types = [
     "nsString",
     ".*char_traits",
     ".*incompatible_char_type",
+    # JS::Value uses alignas(8) which bindgen can't represent correctly on Linux
+    # 32-bit.  See https://github.com/rust-lang-nursery/rust-bindgen/issues/917.
+    # It's also not used by Stylo.  The following types are also hidden for
+    # making use of it and being similarly unused by Stylo.
+    "JS::Value",
+    "mozilla::binding_danger::TErrorResult.*",
+    "mozilla::ErrorResult.*", # Causes JSWhyMagic to be included & handled incorrectly.
+    "mozilla::dom::CallbackFunction",
+    "mozilla::dom::CallbackObject.*",
+    "nsINode_ErrorResult",
+    "nsDOMAttributeMap_ErrorResult",
+    # End of JS::Value related types
 ]
 bitfield-enums = [
     "nsChangeHint",
     "nsRestyleHint",
     "OriginFlags",
 ]
 constified-enums = [
     "UpdateAnimationsTasks",
@@ -320,19 +332,20 @@ opaque-types = [
     "nsIPresShell_ScrollAxis",  # <- For some reason the alignment of this is 4
                                 # for clang.
     "nsPIDOMWindow",  # <- Takes the vtable from a template parameter, and we can't
                       #    generate it conditionally.
     "JS::Rooted",
     "mozilla::Maybe",
     "gfxSize",  # <- union { struct { T width; T height; }; T components[2] };
     "gfxSize_Super",  # Ditto.
-    "mozilla::ErrorResult",  # Causes JSWhyMagic to be included & handled incorrectly.
     "mozilla::StyleAnimationValue",
     "StyleAnimationValue", # pulls in a whole bunch of stuff we don't need in the bindings
+    "mozilla::dom::.*Callback", # Pulls in ErrorResult and other things that
+                                # don't align properly on Linux 32-bit
 ]
 mapped-generic-types = [
     { generic = true, gecko = "mozilla::ServoUnsafeCell", servo = "::std::cell::UnsafeCell" },
     { generic = true, gecko = "mozilla::ServoCell", servo = "::std::cell::Cell" },
     { generic = false, gecko = "ServoNodeData", servo = "AtomicRefCell<ElementData>" },
     { generic = false, gecko = "mozilla::ServoWritingMode", servo = "::logical_geometry::WritingMode" },
     { generic = false, gecko = "mozilla::ServoFontComputationData", servo = "::properties::FontComputationData" },
     { generic = false, gecko = "mozilla::ServoCustomPropertiesMap", servo = "Option<::servo_arc::Arc<::custom_properties::CustomPropertiesMap>>" },