@@ -61,7 +61,7 @@ use rustc_query_system::ich::StableHashingContext;
6161use rustc_session:: cstore:: CrateStoreDyn ;
6262use rustc_session:: parse:: feature_err;
6363use rustc_session:: Session ;
64- use rustc_span:: hygiene:: { ExpnId , MacroKind } ;
64+ use rustc_span:: hygiene:: MacroKind ;
6565use rustc_span:: source_map:: DesugaringKind ;
6666use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
6767use rustc_span:: { Span , DUMMY_SP } ;
@@ -391,6 +391,7 @@ fn compute_hir_hash(
391391 sess : & Session ,
392392 definitions : & Definitions ,
393393 cstore : & CrateStoreDyn ,
394+ resolver : & ResolverOutputs ,
394395 owners : & IndexVec < LocalDefId , hir:: MaybeOwner < & hir:: OwnerInfo < ' _ > > > ,
395396) -> Fingerprint {
396397 let mut hir_body_nodes: Vec < _ > = owners
@@ -404,7 +405,7 @@ fn compute_hir_hash(
404405 hir_body_nodes. sort_unstable_by_key ( |bn| bn. 0 ) ;
405406
406407 let mut stable_hasher = StableHasher :: new ( ) ;
407- let mut hcx = StableHashingContext :: new ( sess, definitions, cstore) ;
408+ let mut hcx = StableHashingContext :: new ( sess, definitions, cstore, & resolver . source_span ) ;
408409 hir_body_nodes. hash_stable ( & mut hcx, & mut stable_hasher) ;
409410 stable_hasher. finish ( )
410411}
@@ -437,7 +438,7 @@ pub fn lower_crate<'hir>(
437438 . lower_node ( def_id) ;
438439 }
439440
440- let hir_hash = compute_hir_hash ( sess, definitions, cstore, & owners) ;
441+ let hir_hash = compute_hir_hash ( sess, definitions, cstore, resolver , & owners) ;
441442 let krate = hir:: Crate { owners, hir_hash } ;
442443 arena. alloc ( krate)
443444}
@@ -459,16 +460,19 @@ enum ParenthesizedGenericArgs {
459460
460461impl < ' a , ' hir > LoweringContext < ' a , ' hir > {
461462 fn create_stable_hashing_context ( & self ) -> StableHashingContext < ' _ > {
462- StableHashingContext :: new ( self . sess , self . definitions , self . cstore )
463+ StableHashingContext :: new (
464+ self . sess ,
465+ self . definitions ,
466+ self . cstore ,
467+ & self . resolver . source_span ,
468+ )
463469 }
464470
465471 fn create_def (
466472 & mut self ,
467473 parent : LocalDefId ,
468474 node_id : ast:: NodeId ,
469475 data : DefPathData ,
470- expn_id : ExpnId ,
471- span : Span ,
472476 ) -> LocalDefId {
473477 assert ! (
474478 self . opt_local_def_id( node_id) . is_none( ) ,
@@ -478,7 +482,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
478482 self . definitions. def_key( self . local_def_id( node_id) ) ,
479483 ) ;
480484
481- let def_id = self . definitions . create_def ( parent, data, expn_id , span ) ;
485+ let def_id = self . definitions . create_def ( parent, data) ;
482486
483487 // Some things for which we allocate `LocalDefId`s don't correspond to
484488 // anything in the AST, so they don't have a `NodeId`. For these cases
@@ -998,13 +1002,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
9981002
9991003 let parent_def_id = self . current_hir_id_owner ;
10001004 let impl_trait_node_id = self . next_node_id ( ) ;
1001- self . create_def (
1002- parent_def_id,
1003- impl_trait_node_id,
1004- DefPathData :: ImplTrait ,
1005- ExpnId :: root ( ) ,
1006- constraint. span ,
1007- ) ;
1005+ self . create_def ( parent_def_id, impl_trait_node_id, DefPathData :: ImplTrait ) ;
10081006
10091007 self . with_dyn_type_scope ( false , |this| {
10101008 let node_id = this. next_node_id ( ) ;
@@ -1110,13 +1108,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11101108 let node_id = self . next_node_id ( ) ;
11111109
11121110 // Add a definition for the in-band const def.
1113- self . create_def (
1114- parent_def_id,
1115- node_id,
1116- DefPathData :: AnonConst ,
1117- ExpnId :: root ( ) ,
1118- ty. span ,
1119- ) ;
1111+ self . create_def ( parent_def_id, node_id, DefPathData :: AnonConst ) ;
11201112
11211113 let span = self . lower_span ( ty. span ) ;
11221114 let path_expr = Expr {
@@ -1624,13 +1616,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16241616 let inner_node_id = self . next_node_id ( ) ;
16251617
16261618 // Add a definition for the in scope lifetime def.
1627- self . create_def (
1628- opaque_ty_def_id,
1629- inner_node_id,
1630- DefPathData :: LifetimeNs ( name) ,
1631- ExpnId :: root ( ) ,
1632- span. with_parent ( None ) ,
1633- ) ;
1619+ self . create_def ( opaque_ty_def_id, inner_node_id, DefPathData :: LifetimeNs ( name) ) ;
16341620
16351621 let ( p_name, inner_res) = match outer_res {
16361622 // Input lifetime like `'a`:
@@ -1824,8 +1810,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
18241810 captured_lifetimes. parent_def_id ,
18251811 p_id,
18261812 DefPathData :: LifetimeNs ( p_name. ident ( ) . name ) ,
1827- ExpnId :: root ( ) ,
1828- span. with_parent ( None ) ,
18291813 ) ;
18301814
18311815 v. insert ( ( span, p_id, p_name, res) ) ;
@@ -1850,8 +1834,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
18501834 captured_lifetimes. parent_def_id ,
18511835 p_id,
18521836 DefPathData :: LifetimeNs ( kw:: UnderscoreLifetime ) ,
1853- ExpnId :: root ( ) ,
1854- span. with_parent ( None ) ,
18551837 ) ;
18561838
18571839 v. insert ( ( span, p_id, ParamName :: Fresh , res) ) ;
@@ -1873,8 +1855,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
18731855 captured_lifetimes. parent_def_id ,
18741856 p_id,
18751857 DefPathData :: LifetimeNs ( kw:: UnderscoreLifetime ) ,
1876- ExpnId :: root ( ) ,
1877- span. with_parent ( None ) ,
18781858 ) ;
18791859 captured_lifetimes
18801860 . captures
0 commit comments