Update Webrender to Rust 2018 Edition
Categories
(Core :: Graphics: WebRender, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox68 | --- | fixed |
People
(Reporter: Gankra, Assigned: Gankra)
References
Details
Attachments
(6 files, 3 obsolete files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
It appears that Bug 1515512 means that we require 1.31 to build, which is the minimum version for Rust 2018.
Details on 2018: https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html
High level: Just run rustfix --edition
which will automatically fix all of our issues and upgrade us. Editions are internally compiled down to a common "primal rust" so upgrading webrender to 2018 has no impact on the rest of firefox or the dependency graph.
One nice advantage of the 2018 edition is the ability to use non-lexical lifetimes.
It looks like all of our compatibility issues are three things:
1:
use sibling_module::foo;
is now
use crate::sibling_module::foo;
2:
fn foo(UnusedArgument) { ... }
must be
fn foo(_: UnusedArgument) { ... }
3:
try is a keyword now, so try! should be changed to using ?
I am looking into this as a simple task to warm up back into the idea of working again.
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Assignee | ||
Comment 2•5 years ago
|
||
Bug 1525402 - run cargo fix --edition on windows
Bug 1525402 - remove unnecessary externs
Bug 1525402 - manual fixup of image_loader
Bug 1525402 - manually fix uses for macos/unix fonts
Bug 1525402 - rerun cargo fix on windows
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Comment 3•5 years ago
|
||
Failed to land:
Details: We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again. (255, 'applying /tmp/tmpYRsqGg\npatching file gfx/wr/wrench/src/rawtest.rs\nHunk #1 FAILED at 1\n1 out of 1 hunks FAILED -- saving rejects to file gfx/wr/wrench/src/rawtest.rs.rej\npatching file gfx/wr/webrender_api/src/lib.rs\nHunk #2 FAILED at 32\n1 out of 2 hunks FAILED -- saving rejects to file gfx/wr/webrender_api/src/lib.rs.rej\npatching file gfx/wr/webrender/src/tiling.rs\nHunk #1 FAILED at 4\n1 out of 1 hunks FAILED -- saving rejects to file gfx/wr/webrender/src/tiling.rs.rej\npatching file gfx/wr/webrender/src/renderer.rs\nHunk #1 succeeded at 45 with fuzz 1 (offset 12 lines).\npatching file gfx/wr/webrender/src/render_backend.rs\nHunk #2 succeeded at 59 with fuzz 2 (offset -1 lines).\npatching file gfx/wr/webrender/src/frame_builder.rs\nHunk #1 FAILED at 4\n1 out of 1 hunks FAILED -- saving rejects to file gfx/wr/webrender/src/frame_builder.rs.rej\npatching file gfx/wr/webrender/src/device/gl.rs\nHunk #1 succeeded at 9 with fuzz 1 (offset -2 lines).\npatching file gfx/wr/webrender/src/debug_render.rs\nHunk #1 FAILED at 3\n1 out of 1 hunks FAILED -- saving rejects to file gfx/wr/webrender/src/debug_render.rs.rej\npatching file gfx/wr/webrender/Cargo.toml\nHunk #2 FAILED at 29\n1 out of 3 hunks FAILED -- saving rejects to file gfx/wr/webrender/Cargo.toml.rej\npatching file gfx/wr/Cargo.lock\nHunk #1 succeeded at 1644 with fuzz 1 (offset 0 lines).\nabort: patch failed to apply', '')
Alexis, can you please take a look?
Assignee | ||
Comment 4•5 years ago
|
||
Bug 1525402 - properly move dependency logic to Cargo.toml
Bug 1525402 - run cargo fix --edition on windows
Bug 1525402 - run cargo fix on windows
Bug 1525402 - remove unnecessary extern crates
Bug 1525402 - manually fix imports for non-windows files
Assignee | ||
Comment 5•5 years ago
|
||
hrm, need an upstream fix to cbindgen https://github.com/eqrion/cbindgen/issues?q=is%3Aissue+is%3Aopen+label%3Arust-2018
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
This version adds support for Rust 2018's new externs
Assignee | ||
Comment 7•5 years ago
|
||
Notably extern crate foo as bar
is no longer supported
(must do it in Cargo.toml). Also stopped using euclid through webrender_api,
because it produces worse results in 2018.
Assignee | ||
Comment 8•5 years ago
|
||
Assignee | ||
Comment 9•5 years ago
|
||
cargo fix works by building under a specific config, so we can't hit both
sides of a mutually exclusive pair of cfgs, such as cfg(target_os) or
when cfg(feature) and cfg(not(feature)) both exist in the codebase.
Assignee | ||
Comment 10•5 years ago
|
||
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 11•5 years ago
|
||
NB: this requires https://github.com/eqrion/cbindgen/pull/332 to land, and for a new version of cbindgen to be published. I've locally verified that I can build firefox on macos with this, but can't do a try push to test out other targets until the publish is done. Also obviously can't land until cbindgen is 0.8.5 is released.
Comment 12•5 years ago
|
||
You can do a try push, just include the appropriate changes to these lines to pull a version with your PR applied.
Assignee | ||
Comment 13•5 years ago
|
||
0.1.21 mishandles cargo package renames, which are a required
feature for Rust 2018 support. The latest version fixes this.
Assignee | ||
Comment 14•5 years ago
|
||
last few tries have looked good (main concern being that we build and don't immediately crash): https://treeherder.mozilla.org/#/jobs?repo=try&revision=813d30d8103820c5a48cd9bb92dd112c3344a0ac
Will rebase once aosmond's P1 fix lands, and push then
Updated•5 years ago
|
Comment 15•5 years ago
|
||
Pushed by abeingessner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ddce4ed9bb05 Bump cbindgen to 0.8.6. r=kvark https://hg.mozilla.org/integration/autoland/rev/0c2296965b7b Bump cargo-vendor to 0.1.23. r=kats https://hg.mozilla.org/integration/autoland/rev/8c7d885ae036 Migrate webrender externs to a Rust 2018 compatible form. r=kvark https://hg.mozilla.org/integration/autoland/rev/16d8a19df813 Manual fixups for configs cargo fix missed. r=kvark https://hg.mozilla.org/integration/autoland/rev/f072f15ba54e Run `cargo fix --edition` on webrender on macos. r=kvark https://hg.mozilla.org/integration/autoland/rev/2371d3a7ab2d Mark all gfx/wr crates as Rust 2018. r=kvark
Comment 16•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/ddce4ed9bb05
https://hg.mozilla.org/mozilla-central/rev/0c2296965b7b
https://hg.mozilla.org/mozilla-central/rev/8c7d885ae036
https://hg.mozilla.org/mozilla-central/rev/16d8a19df813
https://hg.mozilla.org/mozilla-central/rev/f072f15ba54e
https://hg.mozilla.org/mozilla-central/rev/2371d3a7ab2d
Description
•