Description
rust-analyzer version: 0.3.1932-standalone
rustc version: rustc 1.79.0-nightly (7f2fc33da 2024-04-22)
editor or extension: VSCode - rust-analyzer v0.3.1932
relevant settings: rust-analyzer.cargo.target
repository link (if public, optional): Minimal reproducible example (needs nightly toolchain, but that's not relevant to the issue itself)
code snippet to reproduce: Code snippet does not suffice to reproduce, see linked repository
The MRE (minimal reproducible example) enables -Z build-std
via it's .cargo/cargo.toml
. The build-std feature requires that any cargo build/test/run/... command be called with the --target=...
option - compilation fails without it. This makes it ideal to showcase the issue.
The --target x86_64-unknown-linux-gnu
option is set by rust-analyzer.runnables.extraArgs
. Using, for example, code lens to Run the test or the main function of the MRE will work as expected (try it without the rust-analyzer.runnables.extraArgs
setting - it will fail).
However, running the Debug code lens will fail with error: -Zbuild-std requires --target
.
Comparing the relevant code for debug running
rust-analyzer/editors/code/src/debug.ts
Lines 179 to 188 in 47a901b
with the equivalent code for non-debug running
rust-analyzer/editors/code/src/run.ts
Lines 144 to 153 in 47a901b
seems to confirm that
rust-analyzer.runnables.extraArgs
is ignored on debug runs.