mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #13692 - heycam:into-box, r=Manishearth
Fix return types of Owned<T>::into_box Gecko sugar types. <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13692) <!-- Reviewable:end -->
This commit is contained in:
commit
f12b770079
1 changed files with 2 additions and 2 deletions
|
@ -204,7 +204,7 @@ pub struct Owned<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> {
|
||||
|
@ -238,7 +238,7 @@ impl<T> OwnedOrNull<T> {
|
|||
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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue