16
16
17
17
use hir;
18
18
use hir:: def_id:: { CrateNum , DefId , DefIndex , LOCAL_CRATE , DefIndexAddressSpace } ;
19
+ use ich:: Fingerprint ;
19
20
use rustc_data_structures:: fx:: FxHashMap ;
20
21
use rustc_data_structures:: indexed_vec:: IndexVec ;
21
22
use rustc_data_structures:: stable_hasher:: StableHasher ;
@@ -34,7 +35,7 @@ use util::nodemap::NodeMap;
34
35
pub struct DefPathTable {
35
36
index_to_key : [ Vec < DefKey > ; 2 ] ,
36
37
key_to_index : FxHashMap < DefKey , DefIndex > ,
37
- def_path_hashes : [ Vec < u64 > ; 2 ] ,
38
+ def_path_hashes : [ Vec < Fingerprint > ; 2 ] ,
38
39
}
39
40
40
41
// Unfortunately we have to provide a manual impl of Clone because of the
@@ -55,7 +56,7 @@ impl DefPathTable {
55
56
56
57
fn allocate ( & mut self ,
57
58
key : DefKey ,
58
- def_path_hash : u64 ,
59
+ def_path_hash : Fingerprint ,
59
60
address_space : DefIndexAddressSpace )
60
61
-> DefIndex {
61
62
let index = {
@@ -79,7 +80,7 @@ impl DefPathTable {
79
80
}
80
81
81
82
#[ inline( always) ]
82
- pub fn def_path_hash ( & self , index : DefIndex ) -> u64 {
83
+ pub fn def_path_hash ( & self , index : DefIndex ) -> Fingerprint {
83
84
self . def_path_hashes [ index. address_space ( ) . index ( ) ]
84
85
[ index. as_array_index ( ) ]
85
86
}
@@ -146,8 +147,8 @@ impl Decodable for DefPathTable {
146
147
let index_to_key_lo: Vec < DefKey > = Decodable :: decode ( d) ?;
147
148
let index_to_key_hi: Vec < DefKey > = Decodable :: decode ( d) ?;
148
149
149
- let def_path_hashes_lo: Vec < u64 > = Decodable :: decode ( d) ?;
150
- let def_path_hashes_hi: Vec < u64 > = Decodable :: decode ( d) ?;
150
+ let def_path_hashes_lo: Vec < Fingerprint > = Decodable :: decode ( d) ?;
151
+ let def_path_hashes_hi: Vec < Fingerprint > = Decodable :: decode ( d) ?;
151
152
152
153
let index_to_key = [ index_to_key_lo, index_to_key_hi] ;
153
154
let def_path_hashes = [ def_path_hashes_lo, def_path_hashes_hi] ;
@@ -210,7 +211,7 @@ pub struct DefKey {
210
211
}
211
212
212
213
impl DefKey {
213
- fn compute_stable_hash ( & self , parent_hash : u64 ) -> u64 {
214
+ fn compute_stable_hash ( & self , parent_hash : Fingerprint ) -> Fingerprint {
214
215
let mut hasher = StableHasher :: new ( ) ;
215
216
216
217
// We hash a 0u8 here to disambiguate between regular DefPath hashes,
@@ -221,7 +222,7 @@ impl DefKey {
221
222
hasher. finish ( )
222
223
}
223
224
224
- fn root_parent_stable_hash ( crate_name : & str , crate_disambiguator : & str ) -> u64 {
225
+ fn root_parent_stable_hash ( crate_name : & str , crate_disambiguator : & str ) -> Fingerprint {
225
226
let mut hasher = StableHasher :: new ( ) ;
226
227
// Disambiguate this from a regular DefPath hash,
227
228
// see compute_stable_hash() above.
@@ -396,7 +397,7 @@ impl Definitions {
396
397
}
397
398
398
399
#[ inline( always) ]
399
- pub fn def_path_hash ( & self , index : DefIndex ) -> u64 {
400
+ pub fn def_path_hash ( & self , index : DefIndex ) -> Fingerprint {
400
401
self . table . def_path_hash ( index)
401
402
}
402
403
0 commit comments