]> git.lizzy.rs Git - rust.git/blob - src/tools/rustc-workspace-hack/README.md
Rollup merge of #100239 - RalfJung:const-prop-uninit, r=oli-obk
[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/{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 `winapi` in each of
13 these builds. For Cargo, `winapi` has 33 features enabled. In Clippy, however,
14 `winapi` has 22 features enabled. This means that building Cargo and then the
15 Clippy will actually build winapi twice, which in turn will build duplicates
16 of everything that depends on `winapi`. 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.