@@ -47,17 +47,15 @@ use std::sync::Arc;
4747use rustc_ast:: node_id:: NodeMap ;
4848use rustc_ast:: { self as ast, * } ;
4949use rustc_attr_parsing:: { AttributeParser , OmitDoc } ;
50- use rustc_data_structures:: fingerprint:: Fingerprint ;
5150use rustc_data_structures:: sorted_map:: SortedMap ;
52- use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
5351use rustc_data_structures:: tagged_ptr:: TaggedRef ;
5452use rustc_errors:: { DiagArgFromDisplay , DiagCtxtHandle , StashKey } ;
5553use rustc_hir:: def:: { DefKind , LifetimeRes , Namespace , PartialRes , PerNS , Res } ;
5654use rustc_hir:: def_id:: { CRATE_DEF_ID , LOCAL_CRATE , LocalDefId } ;
5755use rustc_hir:: {
5856 self as hir, ConstArg , GenericArg , HirId , ItemLocalMap , LangItem , ParamName , TraitCandidate ,
5957} ;
60- use rustc_index:: { Idx , IndexSlice , IndexVec } ;
58+ use rustc_index:: { Idx , IndexVec } ;
6159use rustc_macros:: extension;
6260use rustc_middle:: span_bug;
6361use rustc_middle:: ty:: { ResolverAstLowering , TyCtxt } ;
@@ -408,29 +406,6 @@ fn index_crate<'a>(
408406 }
409407}
410408
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-
434409pub fn lower_to_hir ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> hir:: Crate < ' _ > {
435410 let sess = tcx. sess ;
436411 // Queries that borrow `resolver_for_lowering`.
@@ -460,10 +435,7 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> hir::Crate<'_> {
460435 drop ( ast_index) ;
461436 sess. time ( "drop_ast" , || drop ( krate) ) ;
462437
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 }
467439}
468440
469441#[ derive( Copy , Clone , PartialEq , Debug ) ]
0 commit comments