Skip to content

Load crates.io dependencies of the standard library #7637

Closed
@jonas-schievink

Description

@jonas-schievink

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 run cargo metadata --locked without requiring any disk operations besides index and crate downloads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-ArchitectureBig architectural things which we need to figure up-front (or suggestions for rewrites :0) )S-unactionableIssue requires feedback, design decisions or is blocked on other work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions