@@ -6,6 +6,8 @@ use crate::ty::TyCtxt;
6
6
7
7
use rustc_ast as ast;
8
8
use rustc_ast:: expand:: allocator:: AllocatorKind ;
9
+ use rustc_data_structures:: fingerprint:: Fingerprint ;
10
+ use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
9
11
use rustc_data_structures:: svh:: Svh ;
10
12
use rustc_data_structures:: sync:: { self , MetadataRef } ;
11
13
use rustc_hir:: def:: DefKind ;
@@ -272,12 +274,16 @@ pub struct HashAndState<T> {
272
274
/// This field is private, and never needs to be accessed by callers of `crate_hash`
273
275
/// or `host_crate_hash`. Its sole purpose is to be hashed as part of the
274
276
/// `HashStable` impl, so that its value influences the hash used by incremental compilation.
275
- real_rust_source_base_dir : Option < PathBuf > ,
277
+ real_rust_source_base_dir : Fingerprint ,
276
278
}
277
279
278
280
impl < T > HashAndState < T > {
279
281
pub fn new ( tcx : TyCtxt < ' tcx > , svh : T ) -> HashAndState < T > {
280
- HashAndState { svh, real_rust_source_base_dir : tcx. sess . real_rust_source_base_dir . clone ( ) }
282
+ let mut hasher = StableHasher :: new ( ) ;
283
+ let mut hcx = tcx. create_stable_hashing_context ( ) ;
284
+ tcx. sess . real_rust_source_base_dir . hash_stable ( & mut hcx, & mut hasher) ;
285
+ let real_rust_source_base_dir = hasher. finish ( ) ;
286
+ HashAndState { svh, real_rust_source_base_dir }
281
287
}
282
288
}
283
289
0 commit comments