@@ -61,7 +61,7 @@ use rustc_query_system::ich::StableHashingContext;
61
61
use rustc_session:: cstore:: CrateStoreDyn ;
62
62
use rustc_session:: parse:: feature_err;
63
63
use rustc_session:: Session ;
64
- use rustc_span:: hygiene:: { ExpnId , MacroKind } ;
64
+ use rustc_span:: hygiene:: MacroKind ;
65
65
use rustc_span:: source_map:: DesugaringKind ;
66
66
use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
67
67
use rustc_span:: { Span , DUMMY_SP } ;
@@ -391,6 +391,7 @@ fn compute_hir_hash(
391
391
sess : & Session ,
392
392
definitions : & Definitions ,
393
393
cstore : & CrateStoreDyn ,
394
+ resolver : & ResolverOutputs ,
394
395
owners : & IndexVec < LocalDefId , hir:: MaybeOwner < & hir:: OwnerInfo < ' _ > > > ,
395
396
) -> Fingerprint {
396
397
let mut hir_body_nodes: Vec < _ > = owners
@@ -404,7 +405,7 @@ fn compute_hir_hash(
404
405
hir_body_nodes. sort_unstable_by_key ( |bn| bn. 0 ) ;
405
406
406
407
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 ) ;
408
409
hir_body_nodes. hash_stable ( & mut hcx, & mut stable_hasher) ;
409
410
stable_hasher. finish ( )
410
411
}
@@ -437,7 +438,7 @@ pub fn lower_crate<'hir>(
437
438
. lower_node ( def_id) ;
438
439
}
439
440
440
- let hir_hash = compute_hir_hash ( sess, definitions, cstore, & owners) ;
441
+ let hir_hash = compute_hir_hash ( sess, definitions, cstore, resolver , & owners) ;
441
442
let krate = hir:: Crate { owners, hir_hash } ;
442
443
arena. alloc ( krate)
443
444
}
@@ -459,16 +460,19 @@ enum ParenthesizedGenericArgs {
459
460
460
461
impl < ' a , ' hir > LoweringContext < ' a , ' hir > {
461
462
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
+ )
463
469
}
464
470
465
471
fn create_def (
466
472
& mut self ,
467
473
parent : LocalDefId ,
468
474
node_id : ast:: NodeId ,
469
475
data : DefPathData ,
470
- expn_id : ExpnId ,
471
- span : Span ,
472
476
) -> LocalDefId {
473
477
assert ! (
474
478
self . opt_local_def_id( node_id) . is_none( ) ,
@@ -478,7 +482,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
478
482
self . definitions. def_key( self . local_def_id( node_id) ) ,
479
483
) ;
480
484
481
- let def_id = self . definitions . create_def ( parent, data, expn_id , span ) ;
485
+ let def_id = self . definitions . create_def ( parent, data) ;
482
486
483
487
// Some things for which we allocate `LocalDefId`s don't correspond to
484
488
// anything in the AST, so they don't have a `NodeId`. For these cases
@@ -998,13 +1002,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
998
1002
999
1003
let parent_def_id = self . current_hir_id_owner ;
1000
1004
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 ) ;
1008
1006
1009
1007
self . with_dyn_type_scope ( false , |this| {
1010
1008
let node_id = this. next_node_id ( ) ;
@@ -1110,13 +1108,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1110
1108
let node_id = self . next_node_id ( ) ;
1111
1109
1112
1110
// 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 ) ;
1120
1112
1121
1113
let span = self . lower_span ( ty. span ) ;
1122
1114
let path_expr = Expr {
@@ -1624,13 +1616,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1624
1616
let inner_node_id = self . next_node_id ( ) ;
1625
1617
1626
1618
// 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) ) ;
1634
1620
1635
1621
let ( p_name, inner_res) = match outer_res {
1636
1622
// Input lifetime like `'a`:
@@ -1824,8 +1810,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1824
1810
captured_lifetimes. parent_def_id ,
1825
1811
p_id,
1826
1812
DefPathData :: LifetimeNs ( p_name. ident ( ) . name ) ,
1827
- ExpnId :: root ( ) ,
1828
- span. with_parent ( None ) ,
1829
1813
) ;
1830
1814
1831
1815
v. insert ( ( span, p_id, p_name, res) ) ;
@@ -1850,8 +1834,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1850
1834
captured_lifetimes. parent_def_id ,
1851
1835
p_id,
1852
1836
DefPathData :: LifetimeNs ( kw:: UnderscoreLifetime ) ,
1853
- ExpnId :: root ( ) ,
1854
- span. with_parent ( None ) ,
1855
1837
) ;
1856
1838
1857
1839
v. insert ( ( span, p_id, ParamName :: Fresh , res) ) ;
@@ -1873,8 +1855,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1873
1855
captured_lifetimes. parent_def_id ,
1874
1856
p_id,
1875
1857
DefPathData :: LifetimeNs ( kw:: UnderscoreLifetime ) ,
1876
- ExpnId :: root ( ) ,
1877
- span. with_parent ( None ) ,
1878
1858
) ;
1879
1859
captured_lifetimes
1880
1860
. captures
0 commit comments