diff --git a/Cargo.lock b/Cargo.lock index e3f2dc8eb7a0..5f4b9dd5d75e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -336,12 +336,12 @@ dependencies = [ "tracing", "tracing-chrome", "tracing-subscriber", + "twox-hash", "unicase", "unicode-width", "url", "walkdir", "windows-sys 0.52.0", - "xxhash-rust", ] [[package]] @@ -3558,6 +3558,17 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "rand", + "static_assertions", +] + [[package]] name = "typeid" version = "1.0.0" @@ -4054,12 +4065,6 @@ dependencies = [ "toml_edit", ] -[[package]] -name = "xxhash-rust" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03" - [[package]] name = "zerocopy" version = "0.7.32" diff --git a/Cargo.toml b/Cargo.toml index c08cb132034d..7d68ad2dd61f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,6 +101,7 @@ toml_edit = { version = "0.22.14", features = ["serde"] } tracing = "0.1.40" # be compatible with rustc_log: https://github.com/rust-lang/rust/blob/e51e98dde6a/compiler/rustc_log/Cargo.toml#L9 tracing-chrome = "0.7.2" tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } +twox-hash = "1.6.3" unicase = "2.7.0" unicode-width = "0.1.12" unicode-xid = "0.2.4" @@ -108,7 +109,6 @@ url = "2.5.0" varisat = "0.2.2" walkdir = "2.5.0" windows-sys = "0.52" -xxhash-rust = { version = "0.8.10", features = ["xxh3"] } [workspace.lints.rust] rust_2018_idioms = "warn" # TODO: could this be removed? @@ -200,11 +200,11 @@ toml.workspace = true toml_edit.workspace = true tracing.workspace = true tracing-subscriber.workspace = true +twox-hash.workspace = true unicase.workspace = true unicode-width.workspace = true url.workspace = true walkdir.workspace = true -xxhash-rust.workspace = true supports-unicode = "3.0.0" [target.'cfg(target_has_atomic = "64")'.dependencies] diff --git a/src/cargo/core/compiler/fingerprint/mod.rs b/src/cargo/core/compiler/fingerprint/mod.rs index ad743656a911..79d09a81576c 100644 --- a/src/cargo/core/compiler/fingerprint/mod.rs +++ b/src/cargo/core/compiler/fingerprint/mod.rs @@ -381,7 +381,7 @@ use serde::de; use serde::ser; use serde::{Deserialize, Serialize}; use tracing::{debug, info}; -use xxhash_rust::xxh3; +use twox_hash::XxHash64; use crate::core::compiler::unit_graph::UnitDep; use crate::core::Package; @@ -2523,7 +2523,7 @@ impl ChecksumAlgo { fn hash_len(&self) -> usize { match self { ChecksumAlgo::Sha256 => 32, - ChecksumAlgo::XxHash => 16, + ChecksumAlgo::XxHash => 8, } } } @@ -2619,11 +2619,11 @@ impl Checksum { } ChecksumAlgo::XxHash => { digest( - xxh3::Xxh3::new(), + XxHash64::with_seed(0), |h, b| { - h.update(b); + h.write(b); }, - |h, out| out.copy_from_slice(&h.digest128().to_be_bytes()), + |h, out| out.copy_from_slice(&h.finish().to_be_bytes()), contents, &mut buf, value,