Skip to content

Commit 652c5d9

Browse files
committed
Update Windows env uppercase key check.
1 parent 3ebb5f1 commit 652c5d9

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

src/cargo/util/config/mod.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,11 @@ impl Config {
232232
})
233233
.collect();
234234

235-
let upper_case_env = if cfg!(windows) {
236-
HashMap::new()
237-
} else {
238-
env.clone()
239-
.into_iter()
240-
.map(|(k, _)| (k.to_uppercase().replace("-", "_"), k))
241-
.collect()
242-
};
235+
let upper_case_env = env
236+
.clone()
237+
.into_iter()
238+
.map(|(k, _)| (k.to_uppercase().replace("-", "_"), k))
239+
.collect();
243240

244241
let cache_rustc_info = match env.get("CARGO_CACHE_RUSTC_INFO") {
245242
Some(cache) => cache != "0",
@@ -696,12 +693,6 @@ impl Config {
696693
}
697694

698695
fn check_environment_key_case_mismatch(&self, key: &ConfigKey) {
699-
if cfg!(windows) {
700-
// In the case of windows the check for case mismatch in keys can be skipped
701-
// as windows already converts its environment keys into the desired format.
702-
return;
703-
}
704-
705696
if let Some(env_key) = self.upper_case_env.get(key.as_env_key()) {
706697
let _ = self.shell().warn(format!(
707698
"Environment variables are expected to use uppercase letters and underscores, \

tests/testsuite/tool_paths.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,12 @@ fn custom_linker_env() {
341341
}
342342

343343
#[cargo_test]
344-
// Temporarily disabled until https://github.com/rust-lang/rust/pull/85270 is in nightly.
345-
#[cfg_attr(target_os = "windows", ignore)]
346344
fn target_in_environment_contains_lower_case() {
345+
if cfg!(windows) && !cargo_test_support::is_nightly() {
346+
// Remove this check when 1.55 is stabilized.
347+
// https://github.com/rust-lang/rust/pull/85270
348+
return;
349+
}
347350
let p = project().file("src/main.rs", "fn main() {}").build();
348351

349352
let target = rustc_host();

0 commit comments

Comments
 (0)