Skip to content

Commit ee53f79

Browse files
committed
switch to using older xxhash64
1 parent bbd49f1 commit ee53f79

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

compiler/rustc_span/src/lib.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
4343
use rustc_serialize::opaque::{FileEncoder, MemDecoder};
4444
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
4545
use tracing::debug;
46-
use twox_hash::xxh3::{self, HasherExt};
46+
use twox_hash::XxHash64;
4747

4848
mod caching_source_map_view;
4949
pub mod source_map;
@@ -1531,7 +1531,9 @@ impl SourceFileHash {
15311531
value.copy_from_slice(&Sha256::digest(data));
15321532
}
15331533
SourceFileHashAlgorithm::XxHash => {
1534-
value.copy_from_slice(&xxh3::hash128(data).to_be_bytes());
1534+
let mut hasher = XxHash64::with_seed(0);
1535+
hasher.write(data);
1536+
value.copy_from_slice(&hasher.finish().to_be_bytes());
15351537
}
15361538
};
15371539
hash
@@ -1569,9 +1571,9 @@ impl SourceFileHash {
15691571
match kind {
15701572
SourceFileHashAlgorithm::XxHash => {
15711573
digest(
1572-
xxh3::Hash128::default(),
1574+
XxHash64::with_seed(0),
15731575
|h, b| h.write(b),
1574-
|h, out| out.copy_from_slice(&h.finish_ext().to_be_bytes()),
1576+
|h, out| out.copy_from_slice(&h.finish().to_be_bytes()),
15751577
src,
15761578
&mut buf,
15771579
value,
@@ -1633,7 +1635,7 @@ impl SourceFileHash {
16331635
SourceFileHashAlgorithm::Md5 => 16,
16341636
SourceFileHashAlgorithm::Sha1 => 20,
16351637
SourceFileHashAlgorithm::Sha256 => 32,
1636-
SourceFileHashAlgorithm::XxHash => 16,
1638+
SourceFileHashAlgorithm::XxHash => 8,
16371639
}
16381640
}
16391641
}

0 commit comments

Comments
 (0)