Skip to content

Commit

Permalink
Fix up Servo_StyleSet_MediumFeaturesChanged 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: LY6z7lEKgOp
  • Loading branch information
jryans committed Aug 16, 2017
1 parent 22e794b commit 25d2b70
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ports/geckolib/glue.rs
Expand Up @@ -900,7 +900,7 @@ pub extern "C" fn Servo_StyleSet_AppendStyleSheet(
pub extern "C" fn Servo_StyleSet_MediumFeaturesChanged(
raw_data: RawServoStyleSetBorrowed,
viewport_units_used: *mut bool,
) -> OriginFlags {
) -> u8 {
let global_style_data = &*GLOBAL_STYLE_DATA;
let guard = global_style_data.shared_lock.read();

Expand All @@ -926,7 +926,10 @@ pub extern "C" fn Servo_StyleSet_MediumFeaturesChanged(
&guard,
);

OriginFlags::from(origins_in_which_rules_changed)
// We'd like to return `OriginFlags` 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.
OriginFlags::from(origins_in_which_rules_changed).0
}

#[no_mangle]
Expand Down

0 comments on commit 25d2b70

Please sign in to comment.