Commit 6093315
committed
Fix [env] in .cargo/config.toml overriding process environment variables
cargo_config_env() only checked extra_env (rust-analyzer.cargo.extraEnv)
when deciding whether to skip an existing variable, but never checked the
actual process environment via std::env::var. This caused config.toml
values to unconditionally override real environment variables even without
force = true, diverging from Cargo's behavior.
Additionally, plain string entries (e.g. `KEY = "value"`) skipped the
force check entirely.
When a process env var takes precedence, its value is now inserted into
the Env so that env!/option_env! resolution stays correct.
Fixes #219941 parent ea1a153 commit 6093315
1 file changed
Lines changed: 20 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
86 | 93 | | |
87 | 94 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
94 | 107 | | |
95 | 108 | | |
96 | 109 | | |
| |||
0 commit comments