Skip to content

Commit

Permalink
Fix up Servo_TakeChangeHint for Linux 32-bit ABI
Browse files Browse the repository at this point in the history
Bindgen bitfield enums don't work as return values with the Linux 32-bit ABI at
the moment because they wrap the value in a struct.

This causes the Rust side to believe the caller will pass along space for the
struct return value, while C++ believes it's just an integer value.

MozReview-Commit-ID: 6qqVVfU8Mb2
  • Loading branch information
jryans committed Aug 16, 2017
1 parent d4b3642 commit 22e794b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ports/geckolib/glue.rs
Expand Up @@ -2831,7 +2831,7 @@ pub extern "C" fn Servo_NoteExplicitHints(element: RawGeckoElementBorrowed,

#[no_mangle]
pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed,
was_restyled: *mut bool) -> nsChangeHint
was_restyled: *mut bool) -> u32
{
let mut was_restyled = unsafe { was_restyled.as_mut().unwrap() };
let element = GeckoElement(element);
Expand All @@ -2852,7 +2852,10 @@ pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed,
};

debug!("Servo_TakeChangeHint: {:?}, damage={:?}", element, damage);
damage.as_change_hint()
// We'd like to return `nsChangeHint` here, but bindgen bitfield enums don't
// work as return values with the Linux 32-bit ABI at the moment because
// they wrap the value in a struct, so for now just unwrap it.
damage.as_change_hint().0
}

#[no_mangle]
Expand Down

0 comments on commit 22e794b

Please sign in to comment.