rust-lang / rust-lang/rust-analyzer

When only showing errors/warnings/messages for the current file, sometimes messages are cryptic when split between files

Open
#23,302 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello all, I erroneously submitted some bugs to LazyVim about this, but it should be reproducable in any editor that supports showing only problems in the current file.

Given this main file:

mod definition;
use definition::*;

fn main() {
    call(3);
}

My definition with this content:

pub fn call(a: String) {
    println!("{}", a);
}

I will get this errors while looking at definition.rs:

function defined here rustc (E0308)

If I select it, it won't lead me to the problem area which makes it extra confusing. Is there a way to make this more helpful?

Image

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

Reproduce the issue using the main file and definition.rs examples, then inspect the diagnostic shown when viewing only problems for definition.rs. Trace how the cross-file Rust error is presented and navigated; done means the message identifies the relevant problem clearly and selecting it leads to the useful location.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.