Closed
Description
The standard library may depend on crates from crates.io, and some of them can be required to properly analyze libstd, like cfg_if
, which caused #6038 in the past. We currently use a hard-coded dependency graph for the sysroot, but have no mechanism to detect or obtain the sources of crates.io dependencies.
We should figure out a way to properly solve this. There are a few options:
- The
rust-src
component could vendor the sources of crates.io dependencies (this seems insufficient though, we might still need to address one of the points below). - We can use the Cargo.lock of the rust-lang/rust monorepo to resolve libstd dependencies via
cargo metadata
, but this requires creating a temporary directory or mutating rustup-installed directories, which is a bad idea. - The compiler and standard library could be split into 2 workspaces, each with their own
Cargo.lock
. Then we could runcargo metadata --locked
without requiring any disk operations besides index and crate downloads.