servo: Merge #13692 - Fix return types of Owned<T>::into_box Gecko sugar types (from heycam:into-box); r=Manishearth
authorCameron McCormack <cam@mcc.id.au>
Wed, 12 Oct 2016 01:15:12 -0500
changeset 339893 c9bc6b91fbec94a4b33d9c2498ee3b6e65f7c8ca
parent 339892 20d58356323629b9b7cd3915842f1979810370dc
child 339894 cd4435e2d8a5ec8acd35431f4ba90f7c16a6799d
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersManishearth
servo: Merge #13692 - Fix return types of Owned<T>::into_box Gecko sugar types (from heycam:into-box); r=Manishearth <!-- Please describe your changes on the following line: --> We're not transmuting to the right type. The only current use of `into_box` is to drop a `PerDocumentStyleData`, so we weren't accidentally doing anything terribly bad, just not calling the `Drop` impl for that type. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: f12b77007981c056098b1daa9b759912d46b7c18
servo/components/style/gecko_bindings/sugar/ownership.rs
--- a/servo/components/style/gecko_bindings/sugar/ownership.rs
+++ b/servo/components/style/gecko_bindings/sugar/ownership.rs
@@ -199,17 +199,17 @@ unsafe impl<T: HasArcFFI> FFIArcHelpers 
 /// Leaks on drop. Please don't drop this.
 pub struct Owned<T> {
     ptr: *mut T,
     _marker: PhantomData<T>,
 }
 
 impl<T> Owned<T> {
     /// Owned<GeckoType> -> Box<ServoType>
-    pub fn into_box<U>(self) -> Box<T> where U: HasBoxFFI<FFIType = T> {
+    pub fn into_box<U>(self) -> Box<U> where U: HasBoxFFI<FFIType = T> {
         unsafe { transmute(self) }
     }
     pub fn maybe(self) -> OwnedOrNull<T> {
         unsafe { transmute(self) }
     }
 }
 
 impl<T> Deref for Owned<T> {
@@ -233,17 +233,17 @@ pub struct OwnedOrNull<T> {
     _marker: PhantomData<T>,
 }
 
 impl<T> OwnedOrNull<T> {
     pub fn is_null(&self) -> bool {
         self.ptr == ptr::null_mut()
     }
     /// OwnedOrNull<GeckoType> -> Option<Box<ServoType>>
-    pub fn into_box_opt<U>(self) -> Option<Box<T>> where U: HasBoxFFI<FFIType = T> {
+    pub fn into_box_opt<U>(self) -> Option<Box<U>> where U: HasBoxFFI<FFIType = T> {
         if self.is_null() {
             None
         } else {
             Some(unsafe { transmute(self) })
         }
     }
 
     /// OwnedOrNull<GeckoType> -> Option<Owned<GeckoType>>