mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Update Windows env uppercase key check.
This commit is contained in:
parent
3ebb5f15a9
commit
652c5d9d1f
@ -232,14 +232,11 @@ impl Config {
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let upper_case_env = if cfg!(windows) {
|
let upper_case_env = env
|
||||||
HashMap::new()
|
.clone()
|
||||||
} else {
|
.into_iter()
|
||||||
env.clone()
|
.map(|(k, _)| (k.to_uppercase().replace("-", "_"), k))
|
||||||
.into_iter()
|
.collect();
|
||||||
.map(|(k, _)| (k.to_uppercase().replace("-", "_"), k))
|
|
||||||
.collect()
|
|
||||||
};
|
|
||||||
|
|
||||||
let cache_rustc_info = match env.get("CARGO_CACHE_RUSTC_INFO") {
|
let cache_rustc_info = match env.get("CARGO_CACHE_RUSTC_INFO") {
|
||||||
Some(cache) => cache != "0",
|
Some(cache) => cache != "0",
|
||||||
@ -696,12 +693,6 @@ impl Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn check_environment_key_case_mismatch(&self, key: &ConfigKey) {
|
fn check_environment_key_case_mismatch(&self, key: &ConfigKey) {
|
||||||
if cfg!(windows) {
|
|
||||||
// In the case of windows the check for case mismatch in keys can be skipped
|
|
||||||
// as windows already converts its environment keys into the desired format.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(env_key) = self.upper_case_env.get(key.as_env_key()) {
|
if let Some(env_key) = self.upper_case_env.get(key.as_env_key()) {
|
||||||
let _ = self.shell().warn(format!(
|
let _ = self.shell().warn(format!(
|
||||||
"Environment variables are expected to use uppercase letters and underscores, \
|
"Environment variables are expected to use uppercase letters and underscores, \
|
||||||
|
@ -341,9 +341,12 @@ fn custom_linker_env() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
// Temporarily disabled until https://github.com/rust-lang/rust/pull/85270 is in nightly.
|
|
||||||
#[cfg_attr(target_os = "windows", ignore)]
|
|
||||||
fn target_in_environment_contains_lower_case() {
|
fn target_in_environment_contains_lower_case() {
|
||||||
|
if cfg!(windows) && !cargo_test_support::is_nightly() {
|
||||||
|
// Remove this check when 1.55 is stabilized.
|
||||||
|
// https://github.com/rust-lang/rust/pull/85270
|
||||||
|
return;
|
||||||
|
}
|
||||||
let p = project().file("src/main.rs", "fn main() {}").build();
|
let p = project().file("src/main.rs", "fn main() {}").build();
|
||||||
|
|
||||||
let target = rustc_host();
|
let target = rustc_host();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user