Backtrace paths show `./src/xxx` instead of `src/xxx`, breaking VSCode navigation

Problem Description

I'm experiencing an issue where rust-analyzer reports diagnostic paths in the format ./src/xxx.rs instead of src/xxx.rs. This breaks VSCode's Ctrl+Click navigation functionality, as VSCode only recognizes the latter format for file navigation, in my environment.

Minimal Reproduction

// src/main.rs
fn error() -> Result<(), ()> {
    Err(())
}

fn main() {
    error().unwrap();
}

Expected: There's a at src/main.rs:xx in the stack backtrace
Actual: There's a at ./src/main.rs:xx in the stack backtrace, which can't be clicked to navigate in VSCode

What I've Tried

  • Verified workspace root contains Cargo.toml
  • Restarted rust-analyzer server multiple times
  • Updated rust-analyzer and VSCode to latest versions
  • Checked various rust-analyzer configuration options

Potential Solution Found

I discovered the rust-analyzer.diagnostics.remapPrefix setting. But it did not work.

{
    "rust-analyzer.diagnostics.remapPrefix": {
        "./": ""
    }
}

Questions

Are there other VSCode settings that might affect diagnostic path formatting? Any insights or alternative solutions would be greatly appreciated!

What's the message from rust-analyzer? This code should compile without warnings (can't check right now, but there should be no place for error), so it's surprising that this kind of issues can happen at all.

I misstated the issue in my title and have revised the post. The example code crashes at error().unwrap() , displaying the crash location as at ./src/xx in the error output. VSCode can navigate to src/xx format but not ./src/xx format.

Backtraces have nothing to do with rust-analyzer. Backtraces are printed by the standard library, which will try to make the file path relative to the current working directory and use the ./ prefix to indicate that it is indeed a relative path:

I'm using vscodium on linux and cannot reproduce the problem, both src/xx and ./src/xx work fine for me.

Thank you. How can I make VSCode navigate to ./src/xx paths? Currently, it only works with src/xx format.

My steps:

  1. cargo new simple
  2. code simple
  3. Copy the example code above to main.rs
  4. Click the run button provided by rust-analyzer
  5. Ctrl+click ./src/main.rs:6:5 in the backtrace
  6. VSCode shows search dialog with "no matching results"
  7. Remove ./ prefix and VSCode navigates correctly

Oh, you use vscodium instead of vscode. The issue may be a bug in vscode.

it feels like a bug of the integrated terminal emulator. but it might also be caused by third party extensions.

although I don't think vscodium is much different than vscode in this case.