@@ -96,6 +96,8 @@ struct LoweringContext<'a, 'hir> {
96
96
97
97
/// Bodies inside the owner being lowered.
98
98
bodies : Vec < ( hir:: ItemLocalId , & ' hir hir:: Body < ' hir > ) > ,
99
+ /// Whether there were inline consts that typeck will split out into bodies
100
+ has_inline_consts : bool ,
99
101
/// Attributes inside the owner being lowered.
100
102
attrs : SortedMap < hir:: ItemLocalId , & ' hir [ Attribute ] > ,
101
103
/// Collect items that were created by lowering the current owner.
@@ -158,6 +160,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
158
160
item_local_id_counter : hir:: ItemLocalId :: ZERO ,
159
161
node_id_to_local_id : Default :: default ( ) ,
160
162
trait_map : Default :: default ( ) ,
163
+ has_inline_consts : false ,
161
164
162
165
// Lowering state.
163
166
catch_scope : None ,
@@ -567,6 +570,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
567
570
568
571
let current_attrs = std:: mem:: take ( & mut self . attrs ) ;
569
572
let current_bodies = std:: mem:: take ( & mut self . bodies ) ;
573
+ let current_has_inline_consts = std:: mem:: take ( & mut self . has_inline_consts ) ;
570
574
let current_node_ids = std:: mem:: take ( & mut self . node_id_to_local_id ) ;
571
575
let current_trait_map = std:: mem:: take ( & mut self . trait_map ) ;
572
576
let current_owner =
@@ -593,6 +597,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
593
597
594
598
self . attrs = current_attrs;
595
599
self . bodies = current_bodies;
600
+ self . has_inline_consts = current_has_inline_consts;
596
601
self . node_id_to_local_id = current_node_ids;
597
602
self . trait_map = current_trait_map;
598
603
self . current_hir_id_owner = current_owner;
@@ -629,6 +634,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
629
634
let attrs = std:: mem:: take ( & mut self . attrs ) ;
630
635
let mut bodies = std:: mem:: take ( & mut self . bodies ) ;
631
636
let trait_map = std:: mem:: take ( & mut self . trait_map ) ;
637
+ let has_inline_consts = std:: mem:: take ( & mut self . has_inline_consts ) ;
632
638
633
639
#[ cfg( debug_assertions) ]
634
640
for ( id, attrs) in attrs. iter ( ) {
@@ -646,7 +652,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
646
652
self . tcx . hash_owner_nodes ( node, & bodies, & attrs) ;
647
653
let num_nodes = self . item_local_id_counter . as_usize ( ) ;
648
654
let ( nodes, parenting) = index:: index_hir ( self . tcx , node, & bodies, num_nodes) ;
649
- let nodes = hir:: OwnerNodes { opt_hash_including_bodies, nodes, bodies } ;
655
+ let nodes = hir:: OwnerNodes { opt_hash_including_bodies, nodes, bodies, has_inline_consts } ;
650
656
let attrs = hir:: AttributeMap { map : attrs, opt_hash : attrs_hash } ;
651
657
652
658
self . arena . alloc ( hir:: OwnerInfo { nodes, parenting, attrs, trait_map } )
0 commit comments