rust-lang / rust-lang/rust-analyzer

Debug mode fails to set CARGO_MANIFEST_DIR environment variable

Open
#16,959 1 comment 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Running a project in Debug mode fails to set CARGO_MANIFEST_DIR environment variable.

rust-analyzer version: v0.3.1896

rustc version: rustc 1.79.0-nightly (85e449a32 2024-03-22)

relevant settings: Default

code snippet to reproduce:

use std::env;

fn main() {
    if let Some(_manifest_dir) = env::var_os("CARGO_MANIFEST_DIR") {
        println!("Found CARGO_MANIFEST_DIR");
    } else {
        println!("Error finding CARGO_MANIFEST_DIR");
    }
}

Pressing Run prints "Found CARGO_MANIFEST_DIR".
Pressing Debug prints "Error finding CARGO_MANIFEST_DIR".

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 reproducing the project in Debug mode with the provided Rust snippet, comparing its environment with Run mode. Trace rust-analyzer's debug launch configuration and identify where CARGO_MANIFEST_DIR should be set; done means Debug prints "Found CARGO_MANIFEST_DIR" consistently with Run.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.