Skip to content

Specify supported Rust versions? #837

@SimonSapin

Description

@SimonSapin

TL;DR: building Servo with the wrong Rust version is a terrible experience and easy to do by mistake, please help us make it harder.


Servo uses its own Rust snapshot, with each Servo commit targeting a specific commit. mach build in Servo downloads a snapshot if necessary, then calls cargo build with the PATH and LD_LIBRARY_PATH environment variables set so that Cargo uses the Rust snapshot.

However, people (myself included) regularly just type cargo build out of habit. Cargo will then use the Rust version installed system-wide if there is one, which might be a nigthly or a release, but is probably incompatible with Servo’s snapshot. Cargo will then start re-building everything (since we’ve changed Rust versions) before (probably) hitting a build error several minutes later. Even if the mistake it caught early and the developer is not utterly confused about what’s going on, the target directory has already been wiped and the developer is punished by having the next mach build do a full build from scratch, which takes a while.

We’ve filed servo/servo#3957 to do something about this, but I believe this requires some help from Cargo. Would it make sense for libraries to specify in Cargo.toml a range of Rust versions they support?

@Manishearth also suggests

Cargo.lock should probably store the rustc version it was compiled with (autogenerated, yay), Cargo.toml can store how fuzzy the rustc version is allowed to be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions