-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Updating the Rust compiler used by Servo
We use Rust compilers built by Rust’s testing infrastructure. Before any pull request is merged into the master
branch of https://github.com/rust-lang/rust/, the corresponding merge commit (made by @bors
) is built and tested on multiple platforms. The Rust team preserves these builds and makes them available.
Find the SHA1 hash of the Rust commit you want to use (visit https://api.github.com/repos/rust-lang/rust/git/refs/heads/master to find the latest commit available), and update the rust-commit-hash
file at the root of the servo repository. mach
will automatically download and use the corresponding Rust build when it is next needed (for example in ./mach fetch
or ./mach build
).
All of our updates are done against a branch named rustup
, which may not exist when no update is in progress.
Servo's dependencies fall into two categories:
-
Libraries maintained by the servo team. For these projects, the main development "trunk" is the
master
branch in theservo/<project>
repo, and this is also the branch used in Servo builds. -
Libraries with a separate upstream maintainer. For these projects, the Servo team maintains a fork at
servo/<project>
with aservo
branch. This is the branch used in Servo builds, and it may also contain Servo-specific changes (e.g. changes that are not yet accepted upstream, or that are not useful outside of the Servo build system). Theservo
fork should not contain amaster
branch, since that branch is not used by the Servo team and could cause confusion if it is out of sync with theservo
branch or the upstreammaster
branch.
When upgrading Servo to a new version of Rust, use the following steps to update each submodule:
-
Make a local clone of the project that you want to change.
-
Update Servo's Cargo overrides to use that clone instead by editing the
.cargo/config
file to have an entry inpaths
pointing at the local clone (see http://doc.crates.io/config.html for an example). -
Merge any changes from the upstream repo (if there is one) into the
servo
repo'sservo
branch—except for changes that require a newer version of Rust than the one Servo is upgrading to. -
Create a new branch named
rustup_<date>
in theservo
fork of the submodule. For example,rustup_20140508
. -
Push any required changes to the
rustup_*
branch. When ready, submit a pull request to the upstream repo for any changes that apply to upstream (if there is one). Then submit a pull request to theservo
repo to merge the same changes, plus any Servo-specific changes. (If there is no separate upstream, just submit a single pull request to themaster
branch in theservo
repo.) -
If you do not have push access to that repo, submit a pull request against a
rustup_*
branch in that repo. -
After the changes are reviewed and merged, remove the
.cargo/config
paths
entry and then usecargo update SUBMODULE -p HASH
to update Servo to use the updated dependency. -
Either push your new changes to Servo's
rustup_DATE
branch or open a PR, if you do not have push access to the Servo repo. Note that we review all Rust upgrade changes at once at the end when it is about to be landed rather than incrementally as the upgrade progresses, in order to bias towards speed of getting the new build up and running.
To test whether a snapshot was built correctly, copy it into the local servo
directory and attempt to build Servo.