rust-lang / rust-lang/docs.rs

CARGO_UNSTABLE_SPARSE_REGISTRY=true breaks dev env doc builds

Open
#1,881 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-builds C-bug E-easy
Dominant language
Rust
Stars
1.2k
Forks
232
Avg merge
11h 35m
Merged PRs (30d)
60

Description

I had CARGO_UNSTABLE_SPARSE_REGISTRY=true in my dev environment, and running cargo run -- build crate rustls 0.20.0 failed with a lot of errors like:

[INFO] [stderr] warning: spurious network error (1 tries remaining): [6] Couldn't resolve host name (Could not resolve host: crates.io)

This is because we fetch dependencies outside the rustwide container, and make them available (via filesystem) inside the container. In my setup, CARGO_UNSTABLE_SPARSE_REGISTRY=true was being observed outside the container, but of course the container does not inherit the environment variable. So cargo inside the container was not seeing the prefetched files and was trying to fetch them.

The big fix here would be to do the fetching inside its own container, which does have network access (unlike the building container).

A couple of smaller fixes we could make:

  • Pass --offline to cargo inside the container so it fails less opaquely if it would need to access the network.
  • Filter all CARGO_* vars from the env before calling cargo.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the cargo run -- build crate rustls 0.20.0 entry point and trace dependency fetching and environment propagation across the rustwide containers. Compare the proposed approaches—fetching in a networked container, passing --offline, or filtering CARGO_* variables—and confirm the build no longer attempts unavailable network access while using prefetched dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.