rust-lang / rust-lang/rust-analyzer

`auto_import` and flyimport for trait use imports should import with `as _` if another trait with the same name is already in scope

Open
#11,224 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-ide C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

if another trait (or type) with the same name is already in scope.

Otherwise we have two traits with the same name in scope which is incorrect, and for these imports we are only interested in the assoc item set being in scope, so using as _ in this specific occasion is alright.

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 locating the auto_import and flyimport handling in rust-analyzer and inspect how trait-use imports are resolved when a same-named trait or type is already in scope. Reproduce that collision and verify the behavior is covered for both import paths; it is done when these imports use as _ only for the described case without changing unrelated imports.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
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.