-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rust-analyzer doesn't fully respect CARGO_TARGET_DIR set with rust-analyzer.server.extraEnv #12760
Comments
I don't know how the configuration works in Atom, but VSCode isn't going to respect settings in a |
This doesn't appear to be correct. If you pull down the project and open it in VSCode, rust-analyzer runs and target/check is populated. The only place that dir is specified is in rust-analyzer.json. target/debug is also populated, which suggests the environment variable is not respected somewhere along the way.
I'm fine with using VSCode for the repro, since it seems to be one of the more popular editors for Rust. |
That's not the case for me. Maybe you have the target dir configured somewhere else as well? Do you have any global VSCode settings for rust-analyzer? |
I don't believe so. I can try to test this in a clean VM later this weekend. |
You could also try changing the path configured in |
Rust-analyzer seems to kick off a cargo command in such a way that a CARGO_TARGET_DIR override set with rust-analyzer.server.extraEnv set in rust-analyzer.json in the project root. This issue popped up in trying to address issue #5828 , where rust-analyzer is invalidating my cargo cache during code analysis in a Cargo workspace with sub-crates that have different build targets.
I've made a fairly small repro case to demonstrate the issue at https://github.com/willhodges/rabug. Simply clone into the repo and then open it in VSCode (with the rust-analyzer extension) or Atom (with the ide-rust extension). The target/debug directory is immediately populated during the first rust-analyzer run despite an override of CARGO_TARGET_DIR in the project's .cargo/config. target/check is also populated, so it would seem at least some of the cargo commands rust-analyzer is running do see the override.
rust-analyzer version: rust-analyzer 0.0.0 (5342f47 2022-07-09)
rustc version: rustc 1.62.0 (a8314ef7d 2022-06-27)
relevant settings: See .cargo/config.toml and rust-analyzer.json in the repository above
The text was updated successfully, but these errors were encountered: