1
1
use crate :: definitions:: { DefKey , DefPathData , DisambiguatedDefPathData } ;
2
+ use rustc_data_structures:: fingerprint:: Fingerprint ;
3
+ use rustc_span:: crate_disambiguator:: CrateDisambiguator ;
2
4
use rustc_span:: def_id:: { DefPathHash , StableCrateId } ;
3
5
4
6
#[ test]
@@ -11,16 +13,17 @@ fn def_path_hash_depends_on_crate_id() {
11
13
// the crate by changing the crate disambiguator (e.g. via bumping the
12
14
// crate's version number).
13
15
14
- let id0 = StableCrateId :: new ( "foo" , false , vec ! [ "1" . to_string ( ) ] ) ;
15
- let id1 = StableCrateId :: new ( "foo" , false , vec ! [ "2" . to_string ( ) ] ) ;
16
+ let d0 = CrateDisambiguator :: from ( Fingerprint :: new ( 12 , 34 ) ) ;
17
+ let d1 = CrateDisambiguator :: from ( Fingerprint :: new ( 56 , 78 ) ) ;
16
18
17
- let h0 = mk_test_hash ( id0 ) ;
18
- let h1 = mk_test_hash ( id1 ) ;
19
+ let h0 = mk_test_hash ( "foo" , d0 ) ;
20
+ let h1 = mk_test_hash ( "foo" , d1 ) ;
19
21
20
22
assert_ne ! ( h0. stable_crate_id( ) , h1. stable_crate_id( ) ) ;
21
23
assert_ne ! ( h0. local_hash( ) , h1. local_hash( ) ) ;
22
24
23
- fn mk_test_hash ( stable_crate_id : StableCrateId ) -> DefPathHash {
25
+ fn mk_test_hash ( crate_name : & str , crate_disambiguator : CrateDisambiguator ) -> DefPathHash {
26
+ let stable_crate_id = StableCrateId :: new ( crate_name, crate_disambiguator) ;
24
27
let parent_hash = DefPathHash :: new ( stable_crate_id, 0 ) ;
25
28
26
29
let key = DefKey {
0 commit comments