Skip to content

Updating the Rust compiler used by Servo

Lars Bergstrom edited this page Dec 30, 2015 · 21 revisions

We use the Rust nightly compilers built by the official Rust team.

Updating the Rust compiler version used in Servo

The file rust-nightly-date contains the date of the nightly build that we will use in Servo. Once the Rust infrastructure has uploaded a build to a URL (e.g., https://static.rust-lang.org/dist/2015-11-09/index.html), enter that date into the hash file and mach will begin using the new binaries.

All of our updates are done against a branch named rustup_DATE, which should be created using the date when we started performing the Rust upgrade.

Updating dependencies

Servo's dependencies fall into two categories:

  1. Libraries maintained by the servo team. For these projects, the main development "trunk" is the master branch in the servo/<project> repo, and this is also the branch used in Servo builds.

  2. Libraries with a separate upstream maintainer. For these projects, the Servo team maintains a fork at servo/<project> with a servo 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). The servo fork should not contain a master branch, since that branch is not used by the Servo team and could cause confusion if it is out of sync with the servo branch or the upstream master branch.

When upgrading Servo to a new version of Rust, use the following steps to update each submodule:

  1. Make a local clone of the project that you want to change.

  2. Update Servo's Cargo overrides to use that clone instead by editing the .cargo/config file to have an entry in paths pointing at the local clone (see http://doc.crates.io/config.html for an example).

  3. Merge any changes from the upstream repo (if there is one) into the servo repo's servo branch—except for changes that require a newer version of Rust than the one Servo is upgrading to.

  4. Create a new branch named rustup_<date> in the servo fork of the submodule. For example, rustup_20140508.

  5. 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 the servo repo to merge the same changes, plus any Servo-specific changes. (If there is no separate upstream, just submit a single pull request to the master branch in the servo repo.)

  6. If you do not have push access to that repo, submit a pull request against a rustup_* branch in that repo.

  7. After the changes are reviewed and merged, remove the .cargo/config paths entry and then use cargo update SUBMODULE -p HASH to update Servo to use the updated dependency.

  8. 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.

Testing

To test whether a snapshot was built correctly, copy it into the local servo directory and attempt to build Servo.

Clone this wiki locally