Closed Bug 1408622 Opened 2 years ago Closed 2 years ago

stylo: expected lifetime parameter with rust 1.21

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox57 --- unaffected
firefox58 --- fixed

People

(Reporter: rillian, Assigned: emilio)

References

Details

Building stylo with rust 1.21.0 started failing recently.

>  error[E0106]: missing lifetime specifier
>      --> /builds/worker/workspace/build/src/obj-firefox/toolkit/library/x86_64-unknown-linux-gnu/release/build/style-c4949dd4c23a1f5b/out/gecko/bindings.rs:2129:9
>       |
>  2129 |      -> RawGeckoElementBorrowedOrNull;
>       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected lifetime parameter
>       |
>       = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2
>  error: aborting due to previous error
>  error: Could not compile `style`.
Looks like maybe an issue with the bindgen output.
Blocks: 1408215
Looks like the culprit is bug 1407952. geckolib/glue.rs defines:

> pub unsafe extern "C" fn Servo_SelectorList_Closest<'a>(
>     element: RawGeckoElementBorrowed<'a>,
>     selectors: RawServoSelectorListBorrowed,
> ) -> RawGeckoElementBorrowedOrNull<'a>

SERVO_BINDING_FUNC() + bindgen turn this into:

> extern "C" {
>     pub fn Servo_SelectorList_Closest(arg1: RawGeckoElementBorrowed,
>                                       arg2: RawServoSelectorListBorrowed)
>      -> RawGeckoElementBorrowedOrNull;
> }

Dropping the lifetime annotation.
Blocks: 1407952
Yeah, I find our bindings stuff super over-engineered, and this is part of the problem with it :(

For now the easy solution is making that function use `const Element*` instead of `RawGeckoElementBorrowed`, and adjust the rust code too. We should look into removing all the boilerplate and magic of our binding functions IMO.
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/de9496ac2ea8
Dumb down the return value of Servo_SelectorList_Closest. r=me
https://hg.mozilla.org/mozilla-central/rev/de9496ac2ea8
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Assignee: nobody → emilio
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.