rust-lang / rust-lang/rust

Suggest installing `rust-std` component when spans pointing at std can't find the sources

Open
#156,402 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics A-dist-components D-papercut D-terse P-low T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

https://users.rust-lang.org/t/any-plans-for-improving-error-diagnostic-in-rust-2-0/139956/12

We have a fallback for span sources not being found, rendering labels as notes. But it would be reasonable to include a suggestion in the output when we encounter them, exclusively for the std when the current rustc is from a standard installation through rustup, telling people to use rustup to install the std sources locally so that subsequent errors will provide the desired output. For non-standard installs (like local dev or through package managers) we can either not say anything, or hint towards it. For missing spans from other crates, the current behavior is likely fine (and less likely to occur in the first place).

Contributor guide

Open the contributing guide

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 by tracing the fallback that renders labels as notes when span sources are missing, then inspect how the compiler can identify standard rustup installations and missing std sources. Done means std-source failures from rustup installations suggest installing the rust-std component, while non-standard installs and missing sources from other crates retain the current behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.