rust/src/tools/rustc-workspace-hack
Aaron Hill e2ab98df08
Stop using old version of syn in rustc-workspace-hack
None of the tools seem to need syn 0.15.35, so we can just build syn
1.0.

This was causing an issue with clippy's `compile-test` program: since
multiple versions of `syn` would exist in the build directory, we would
non-deterministically pick one based on filesystem iteration order. If
the pre-1.0 version of `syn` was picked, a strange build error would
occur (see
https://github.com/rust-lang/rust/pull/73594#issuecomment-647671463)

To prevent this kind of issue from happening again, we now panic if we
find multiple versions of a crate in the build directly, instead of
silently picking the first version we find.
2020-06-22 13:29:39 -04:00
..
Cargo.toml Stop using old version of syn in rustc-workspace-hack 2020-06-22 13:29:39 -04:00
lib.rs Remove licenses 2018-12-25 21:08:33 -07:00
README.md Update Cargo submodule 2018-08-02 18:09:19 -07:00

rustc-workspace-hack

This crate is a bit of a hack to make workspaces in rustc work a bit better. The rationale for this existence is a bit subtle, but the general idea is that we want commands like ./x.py build src/tools/{rls,clippy,cargo} to share as many dependencies as possible.

Each invocation is a different invocation of Cargo, however. Each time Cargo runs a build it will re-resolve the dependency graph, notably selecting different features sometimes for each build.

For example, let's say there's a very deep dependency like num-traits in each of these builds. For Cargo the num-traits's default feature is turned off. In RLS, however, the default feature is turned. This means that building Cargo and then the RLS will actually build Cargo twice (as a transitive dependency changed). This is bad!

The goal of this crate is to solve this problem and ensure that the resolved dependency graph for all of these tools is the same in the various subsets of each tool, notably enabling the same features of transitive dependencies.

All tools vendored here depend on the rustc-workspace-hack crate on crates.io. When on crates.io this crate is an empty crate that is just a noop. We override it, however, in this workspace to this crate here, which means we can control crates in the dependency graph for each of these tools.