rust-lang / rust-lang/rust-analyzer

Emit diagnostics for unresolved methond calls where fix (import trait) is available

Open
#6,859 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics S-actionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Quite often methods on a particular type can not be found since the trait was not bought into scope with a use statement. Would it be possible to index the traits from the crates listed as dependencies in Cargo.toml and to improve the lint from:

no method named XXX found for struct

to:

method XXX is only available when you bring trait YYY into scope

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

Inspect rust-analyzer's unresolved-method diagnostics and how it indexes traits from dependency crates listed in Cargo.toml. Compare the current no-method-found output with the requested trait-import suggestion, and define completion as emitting the suggested trait and import guidance when that information is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.