]> git.lizzy.rs Git - rust.git/blob - src/tools/rustc-workspace-hack/README.md
Rollup merge of #89816 - Canop:master, r=Mark-Simulacrum
[rust.git] / src / tools / rustc-workspace-hack / README.md
1 # `rustc-workspace-hack`
2
3 This crate is a bit of a hack to make workspaces in rustc work a bit better.
4 The rationale for this existence is a bit subtle, but the general idea is that
5 we want commands like `./x.py build src/tools/{rls,clippy,cargo}` to share as
6 many dependencies as possible.
7
8 Each invocation is a different invocation of Cargo, however. Each time Cargo
9 runs a build it will re-resolve the dependency graph, notably selecting
10 different features sometimes for each build.
11
12 For example, let's say there's a very deep dependency like `num-traits` in each
13 of these builds. For Cargo the `num-traits`'s `default` feature is turned off.
14 In RLS, however, the `default` feature is turned. This means that building Cargo
15 and then the RLS will actually build Cargo twice (as a transitive dependency
16 changed). This is bad!
17
18 The goal of this crate is to solve this problem and ensure that the resolved
19 dependency graph for all of these tools is the same in the various subsets of
20 each tool, notably enabling the same features of transitive dependencies.
21
22 All tools vendored here depend on the `rustc-workspace-hack` crate on crates.io.
23 When on crates.io this crate is an empty crate that is just a noop. We override
24 it, however, in this workspace to this crate here, which means we can control
25 crates in the dependency graph for each of these tools.