rust-lang / rust-lang/rust-playground

Compiler import suggestions are not useful

Open
#445 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted maintenance
Dominant language
Rust
Stars
1.4k
Forks
267
Avg merge
3h 2m
Merged PRs (30d)
6

Description

The combination of the large amount of crates loaded by default on the playground and Rust 2018 no longer requiring extern crate has created a usability problem.

Consider the following code:

fn main() {
    let _: Error;
}

This will result in this compile error:

error[E0412]: cannot find type `Error` in this scope
 --> src/main.rs:2:12
  |
2 |     let _: Error;
  |            ^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
  |
1 | use cc::Error;
  |
1 | use clap::Error;
  |
1 | use core::fmt::Error;
  |
1 | use csv::Error;
  |
and 53 other candidates

Previously, it would've only shown suggestions from std, which is probably what I wanted. I don't know how this could be reasonably fixed.

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

Reproduce the Rust 2018 example in the Playground with its default crates and inspect how compiler import suggestions are produced. Determine whether the fix belongs in the Playground setup or suggestion behavior; done means common unresolved names produce useful, focused candidates instead of a long list of unrelated crates.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, developer-experience
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.