rust-lang / rust-lang/rust

Misspelled module names should look for similar modules

Open
#131,366 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics A-suggestion-diagnostics T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code

use std::collection::HashMap;

Current output
error[E0432]: unresolved import `std::collection`
 --> src/main.rs:1:10
  |
1 | use std::collection::HashMap;
  |          ^^^^^^^^^^ could not find `collection` in `std`
Desired output

rustc should do the same similarity search it currently does for other identifiers, to be able to say "did you mean std::collections::HashMap".

Rationale and extra context

No response

Other cases

No response

Rust Version

rustc 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: x86_64-unknown-linux-gnu
release: 1.81.0
LLVM version: 18.1.7

Anything else?

No response

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

The issue names no file or test path; begin by locating rustc's existing identifier similarity suggestions and the diagnostic path for unresolved imports such as std::collection. Add coverage for the shown import and verify that the diagnostic suggests std::collections::HashMap.

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
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.