X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=src%2Fcargo%2Fcore%2Fcompiler%2Fcompile_kind.rs;fp=src%2Fcargo%2Fcore%2Fcompiler%2Fcompile_kind.rs;h=7ab19ae1ccf22bb0b6b2284e51795cd9bebf8ff4;hb=68504ae0fc51532f2649b7e5aba696b4b0744682;hp=c3c921d41469e53a22b5c9bb8ea616821a5d8015;hpb=62c5094d5265fc90ea4602c817a684f71753f356;p=cargo.git diff --git a/src/cargo/core/compiler/compile_kind.rs b/src/cargo/core/compiler/compile_kind.rs index c3c921d41..7ab19ae1c 100644 --- a/src/cargo/core/compiler/compile_kind.rs +++ b/src/cargo/core/compiler/compile_kind.rs @@ -2,7 +2,7 @@ use crate::core::Target; use crate::util::errors::CargoResult; use crate::util::interning::InternedString; use crate::util::{Config, StableHasher}; -use anyhow::{bail, Context as _}; +use anyhow::Context as _; use serde::Serialize; use std::collections::BTreeSet; use std::fs; @@ -65,9 +65,6 @@ impl CompileKind { }; if !targets.is_empty() { - if targets.len() > 1 && !config.cli_unstable().multitarget { - bail!("specifying multiple `--target` flags requires `-Zmultitarget`") - } return dedup(targets); } @@ -182,14 +179,20 @@ impl CompileTarget { /// See [`CompileKind::fingerprint_hash`]. pub fn fingerprint_hash(&self) -> u64 { let mut hasher = StableHasher::new(); - self.name.hash(&mut hasher); - if self.name.ends_with(".json") { - // This may have some performance concerns, since it is called - // fairly often. If that ever seems worth fixing, consider - // embedding this in `CompileTarget`. - if let Ok(contents) = fs::read_to_string(self.name) { + match self + .name + .ends_with(".json") + .then(|| fs::read_to_string(self.name)) + { + Some(Ok(contents)) => { + // This may have some performance concerns, since it is called + // fairly often. If that ever seems worth fixing, consider + // embedding this in `CompileTarget`. contents.hash(&mut hasher); } + _ => { + self.name.hash(&mut hasher); + } } hasher.finish() }