@@ -47,17 +47,15 @@ use std::sync::Arc;
47
47
use rustc_ast:: node_id:: NodeMap ;
48
48
use rustc_ast:: { self as ast, * } ;
49
49
use rustc_attr_parsing:: { AttributeParser , OmitDoc } ;
50
- use rustc_data_structures:: fingerprint:: Fingerprint ;
51
50
use rustc_data_structures:: sorted_map:: SortedMap ;
52
- use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
53
51
use rustc_data_structures:: tagged_ptr:: TaggedRef ;
54
52
use rustc_errors:: { DiagArgFromDisplay , DiagCtxtHandle , StashKey } ;
55
53
use rustc_hir:: def:: { DefKind , LifetimeRes , Namespace , PartialRes , PerNS , Res } ;
56
54
use rustc_hir:: def_id:: { CRATE_DEF_ID , LOCAL_CRATE , LocalDefId } ;
57
55
use rustc_hir:: {
58
56
self as hir, ConstArg , GenericArg , HirId , ItemLocalMap , LangItem , ParamName , TraitCandidate ,
59
57
} ;
60
- use rustc_index:: { Idx , IndexSlice , IndexVec } ;
58
+ use rustc_index:: { Idx , IndexVec } ;
61
59
use rustc_macros:: extension;
62
60
use rustc_middle:: span_bug;
63
61
use rustc_middle:: ty:: { ResolverAstLowering , TyCtxt } ;
@@ -408,29 +406,6 @@ fn index_crate<'a>(
408
406
}
409
407
}
410
408
411
- /// Compute the hash for the HIR of the full crate.
412
- /// This hash will then be part of the crate_hash which is stored in the metadata.
413
- fn compute_hir_hash (
414
- tcx : TyCtxt < ' _ > ,
415
- owners : & IndexSlice < LocalDefId , hir:: MaybeOwner < ' _ > > ,
416
- ) -> Fingerprint {
417
- let mut hir_body_nodes: Vec < _ > = owners
418
- . iter_enumerated ( )
419
- . filter_map ( |( def_id, info) | {
420
- let info = info. as_owner ( ) ?;
421
- let def_path_hash = tcx. hir_def_path_hash ( def_id) ;
422
- Some ( ( def_path_hash, info) )
423
- } )
424
- . collect ( ) ;
425
- hir_body_nodes. sort_unstable_by_key ( |bn| bn. 0 ) ;
426
-
427
- tcx. with_stable_hashing_context ( |mut hcx| {
428
- let mut stable_hasher = StableHasher :: new ( ) ;
429
- hir_body_nodes. hash_stable ( & mut hcx, & mut stable_hasher) ;
430
- stable_hasher. finish ( )
431
- } )
432
- }
433
-
434
409
pub fn lower_to_hir ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> hir:: Crate < ' _ > {
435
410
let sess = tcx. sess ;
436
411
// Queries that borrow `resolver_for_lowering`.
@@ -460,10 +435,7 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> hir::Crate<'_> {
460
435
drop ( ast_index) ;
461
436
sess. time ( "drop_ast" , || drop ( krate) ) ;
462
437
463
- // Don't hash unless necessary, because it's expensive.
464
- let opt_hir_hash =
465
- if tcx. needs_crate_hash ( ) { Some ( compute_hir_hash ( tcx, & owners) ) } else { None } ;
466
- hir:: Crate { owners, opt_hir_hash }
438
+ hir:: Crate { owners }
467
439
}
468
440
469
441
#[ derive( Copy , Clone , PartialEq , Debug ) ]
0 commit comments