Because of a change in tooling, I now need to set an environment variable in .cargo/config.toml. My intent is to have invocations of cargo by rust-analyzer and the user themselves read and execute using this environment variable.
- If this environment variable is not set, the program will not compile.
- This environment variable is confirmed to function, as if I
exportit in a justfile or set it manually the program compiles. However, when rust-analyzer runs, it resets the variable to its default, empty value and runs without it. - I am relatively certain that cargo is reading from the config.toml file, as if I set other values or insert gibberish, cargo reacts accordingly
- I have tried setting CARGO_ENCODED_RUSTFLAGS and RUSTFLAGS both with and without force being set and the variable does not get applied
- I have also tried to set
build.rustflagsbut this causes a parsing error.
I am on Windows 10, and this behavior is exhibited both in powershell and cmd.exe