Skip to content

Commit 10e289e

Browse files
Make debuginfo::UniqueTypeId use 128 bit hash.
1 parent 74ebad4 commit 10e289e

File tree

2 files changed

+3
-35
lines changed

2 files changed

+3
-35
lines changed

src/librustc_data_structures/stable_hasher.rs

-31
Original file line numberDiff line numberDiff line change
@@ -61,37 +61,6 @@ impl<W: StableHasherResult> StableHasher<W> {
6161
}
6262
}
6363

64-
impl StableHasherResult for [u8; 20] {
65-
fn finish(hasher: StableHasher<Self>) -> Self {
66-
let (_0, _1) = hasher.finalize();
67-
68-
[
69-
(_0 >> 0) as u8,
70-
(_0 >> 8) as u8,
71-
(_0 >> 16) as u8,
72-
(_0 >> 24) as u8,
73-
(_0 >> 32) as u8,
74-
(_0 >> 40) as u8,
75-
(_0 >> 48) as u8,
76-
(_0 >> 56) as u8,
77-
78-
17,
79-
33,
80-
47,
81-
3,
82-
83-
(_1 >> 0) as u8,
84-
(_1 >> 8) as u8,
85-
(_1 >> 16) as u8,
86-
(_1 >> 24) as u8,
87-
(_1 >> 32) as u8,
88-
(_1 >> 40) as u8,
89-
(_1 >> 48) as u8,
90-
(_1 >> 56) as u8,
91-
]
92-
}
93-
}
94-
9564
impl StableHasherResult for u128 {
9665
fn finish(hasher: StableHasher<Self>) -> Self {
9766
let (_0, _1) = hasher.finalize();

src/librustc_trans/debuginfo/metadata.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use rustc::ty::fold::TypeVisitor;
3030
use rustc::ty::subst::Substs;
3131
use rustc::ty::util::TypeIdHasher;
3232
use rustc::hir;
33-
use rustc_data_structures::ToHex;
33+
use rustc::ich::Fingerprint;
3434
use {type_of, machine, monomorphize};
3535
use common::{self, CrateContext};
3636
use type_::Type;
@@ -146,11 +146,10 @@ impl<'tcx> TypeMap<'tcx> {
146146

147147
// The hasher we are using to generate the UniqueTypeId. We want
148148
// something that provides more than the 64 bits of the DefaultHasher.
149-
150-
let mut type_id_hasher = TypeIdHasher::<[u8; 20]>::new(cx.tcx());
149+
let mut type_id_hasher = TypeIdHasher::<Fingerprint>::new(cx.tcx());
151150
type_id_hasher.visit_ty(type_);
152-
153151
let unique_type_id = type_id_hasher.finish().to_hex();
152+
154153
let key = self.unique_id_interner.intern(&unique_type_id);
155154
self.type_to_unique_id.insert(type_, UniqueTypeId(key));
156155

0 commit comments

Comments
 (0)