Skip to content

Commit ea204a4

Browse files
incr.comp.: Use 128-bit Metrohash instead of BLAKE2 for computing ICHs.
1 parent c597d45 commit ea204a4

File tree

3 files changed

+282
-64
lines changed

3 files changed

+282
-64
lines changed

src/librustc/ich/fingerprint.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111
use rustc_data_structures::stable_hasher;
12-
use std::mem;
13-
use std::slice;
12+
// use std::mem;
13+
// use std::slice;
1414

1515
#[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Clone, Copy, RustcEncodable, RustcDecodable)]
1616
pub struct Fingerprint(u64, u64);
@@ -55,15 +55,8 @@ impl ::std::fmt::Display for Fingerprint {
5555

5656
impl stable_hasher::StableHasherResult for Fingerprint {
5757
fn finish(mut hasher: stable_hasher::StableHasher<Self>) -> Self {
58-
let hash_bytes: &[u8] = hasher.finalize();
59-
60-
assert!(hash_bytes.len() >= mem::size_of::<u64>() * 2);
61-
let hash_bytes: &[u64] = unsafe {
62-
slice::from_raw_parts(hash_bytes.as_ptr() as *const u64, 2)
63-
};
64-
65-
// The bytes returned bytes the Blake2B hasher are always little-endian.
66-
Fingerprint(u64::from_le(hash_bytes[0]), u64::from_le(hash_bytes[1]))
58+
let (_0, _1) = hasher.finalize();
59+
Fingerprint(_0, _1)
6760
}
6861
}
6962

src/librustc_data_structures/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#![feature(fn_traits)]
2929
#![feature(unsize)]
3030
#![feature(i128_type)]
31+
#![feature(i128)]
3132
#![feature(conservative_impl_trait)]
3233
#![feature(specialization)]
3334

0 commit comments

Comments
 (0)