diff --git a/src/cargo/util/config/mod.rs b/src/cargo/util/config/mod.rs index dbf4e3d53b6..53badb21287 100644 --- a/src/cargo/util/config/mod.rs +++ b/src/cargo/util/config/mod.rs @@ -1690,7 +1690,7 @@ impl Config { .try_borrow_with(|| self.get::("env"))?; if env_config.get("CARGO_HOME").is_some() { - bail!("`CARGO_HOME` environment variable should be not be set in `.cargo/config` via `env.CARGO_HOME` as cargo does not use this value directly (only recursive calls to cargo would)"); + bail!("setting the `CARGO_HOME` environment variable is not supported in the `[env]` configuration table") } Ok(env_config) diff --git a/tests/testsuite/cargo_env_config.rs b/tests/testsuite/cargo_env_config.rs index 76f81e9b797..1872d56c004 100644 --- a/tests/testsuite/cargo_env_config.rs +++ b/tests/testsuite/cargo_env_config.rs @@ -79,7 +79,7 @@ fn env_no_cargo_home() { p.cargo("build") .with_status(101) - .with_stderr_contains("[..]`CARGO_HOME` environment variable should be not be set in `.cargo/config` via `env.CARGO_HOME` as cargo does not use this value directly (only recursive calls to cargo would)") + .with_stderr_contains("[..]setting the `CARGO_HOME` environment variable is not supported in the `[env]` configuration table") .run(); }