Skip to content

Commit 2fce10d

Browse files
committed
Add a comment describing why these are disallowed.
1 parent 4ec06f4 commit 2fce10d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/cargo/util/config/mod.rs

+14
Original file line numberDiff line numberDiff line change
@@ -1745,6 +1745,20 @@ impl Config {
17451745
.env_config
17461746
.try_borrow_with(|| self.get::<EnvConfig>("env"))?;
17471747

1748+
// Reasons for disallowing these values:
1749+
//
1750+
// - CARGO_HOME: The initial call to cargo does not honor this value
1751+
// from the [env] table. Recursive calls to cargo would use the new
1752+
// value, possibly behaving differently from the outer cargo.
1753+
//
1754+
// - RUSTUP_HOME: Under normal usage with rustup, this will have no
1755+
// effect because the rustup proxy sets RUSTUP_HOME, and that would
1756+
// override the [env] table. If the outer cargo is executed directly
1757+
// circumventing the rustup proxy, then this would affect calls to
1758+
// rustc (assuming that is a proxy), which could potentially cause
1759+
// problems with cargo and rustc being from different toolchains. We
1760+
// consider this to be not a use case we would like to support,
1761+
// since it will likely cause problems or lead to confusion.
17481762
for disallowed in &["CARGO_HOME", "RUSTUP_HOME"] {
17491763
if env_config.contains_key(*disallowed) {
17501764
bail!(

0 commit comments

Comments
 (0)