@@ -479,8 +479,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
479
479
expr : & ' hir hir:: Expr < ' hir > ,
480
480
overall_span : Span ,
481
481
) -> & ' hir hir:: Expr < ' hir > {
482
- let constructor =
483
- self . arena . alloc ( self . expr_lang_item_path ( method_span, lang_item, ThinVec :: new ( ) ) ) ;
482
+ let constructor = self . arena . alloc ( self . expr_lang_item_path (
483
+ method_span,
484
+ lang_item,
485
+ ThinVec :: new ( ) ,
486
+ None ,
487
+ ) ) ;
484
488
self . expr_call ( overall_span, constructor, std:: slice:: from_ref ( expr) )
485
489
}
486
490
@@ -584,8 +588,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
584
588
// `future::from_generator`:
585
589
let unstable_span =
586
590
self . mark_span_with_reason ( DesugaringKind :: Async , span, self . allow_gen_future . clone ( ) ) ;
587
- let gen_future =
588
- self . expr_lang_item_path ( unstable_span, hir:: LangItem :: FromGenerator , ThinVec :: new ( ) ) ;
591
+ let gen_future = self . expr_lang_item_path (
592
+ unstable_span,
593
+ hir:: LangItem :: FromGenerator ,
594
+ ThinVec :: new ( ) ,
595
+ None ,
596
+ ) ;
589
597
590
598
// `future::from_generator(generator)`:
591
599
hir:: ExprKind :: Call ( self . arena . alloc ( gen_future) , arena_vec ! [ self ; generator] )
@@ -657,16 +665,19 @@ impl<'hir> LoweringContext<'_, 'hir> {
657
665
span,
658
666
hir:: LangItem :: PinNewUnchecked ,
659
667
arena_vec ! [ self ; ref_mut_pinned] ,
668
+ Some ( expr. hir_id ) ,
660
669
) ;
661
670
let get_context = self . expr_call_lang_item_fn_mut (
662
671
gen_future_span,
663
672
hir:: LangItem :: GetContext ,
664
673
arena_vec ! [ self ; task_context] ,
674
+ Some ( expr. hir_id ) ,
665
675
) ;
666
676
let call = self . expr_call_lang_item_fn (
667
677
span,
668
678
hir:: LangItem :: FuturePoll ,
669
679
arena_vec ! [ self ; new_unchecked, get_context] ,
680
+ Some ( expr. hir_id ) ,
670
681
) ;
671
682
self . arena . alloc ( self . expr_unsafe ( call) )
672
683
} ;
@@ -679,7 +690,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
679
690
let ( x_pat, x_pat_hid) = self . pat_ident ( span, x_ident) ;
680
691
let x_expr = self . expr_ident ( span, x_ident, x_pat_hid) ;
681
692
let ready_field = self . single_pat_field ( span, x_pat) ;
682
- let ready_pat = self . pat_lang_item_variant ( span, hir:: LangItem :: PollReady , ready_field) ;
693
+ let ready_pat = self . pat_lang_item_variant (
694
+ span,
695
+ hir:: LangItem :: PollReady ,
696
+ ready_field,
697
+ Some ( expr. hir_id ) ,
698
+ ) ;
683
699
let break_x = self . with_loop_scope ( loop_node_id, move |this| {
684
700
let expr_break =
685
701
hir:: ExprKind :: Break ( this. lower_loop_destination ( None ) , Some ( x_expr) ) ;
@@ -690,7 +706,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
690
706
691
707
// `::std::task::Poll::Pending => {}`
692
708
let pending_arm = {
693
- let pending_pat = self . pat_lang_item_variant ( span, hir:: LangItem :: PollPending , & [ ] ) ;
709
+ let pending_pat = self . pat_lang_item_variant (
710
+ span,
711
+ hir:: LangItem :: PollPending ,
712
+ & [ ] ,
713
+ Some ( expr. hir_id ) ,
714
+ ) ;
694
715
let empty_block = self . expr_block_empty ( span) ;
695
716
self . arm ( pending_pat, empty_block)
696
717
} ;
@@ -1161,7 +1182,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
1161
1182
fn lower_expr_range_closed ( & mut self , span : Span , e1 : & Expr , e2 : & Expr ) -> hir:: ExprKind < ' hir > {
1162
1183
let e1 = self . lower_expr_mut ( e1) ;
1163
1184
let e2 = self . lower_expr_mut ( e2) ;
1164
- let fn_path = hir:: QPath :: LangItem ( hir:: LangItem :: RangeInclusiveNew , self . lower_span ( span) ) ;
1185
+ let fn_path =
1186
+ hir:: QPath :: LangItem ( hir:: LangItem :: RangeInclusiveNew , self . lower_span ( span) , None ) ;
1165
1187
let fn_expr =
1166
1188
self . arena . alloc ( self . expr ( span, hir:: ExprKind :: Path ( fn_path) , ThinVec :: new ( ) ) ) ;
1167
1189
hir:: ExprKind :: Call ( fn_expr, arena_vec ! [ self ; e1, e2] )
@@ -1195,7 +1217,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1195
1217
) ;
1196
1218
1197
1219
hir:: ExprKind :: Struct (
1198
- self . arena . alloc ( hir:: QPath :: LangItem ( lang_item, self . lower_span ( span) ) ) ,
1220
+ self . arena . alloc ( hir:: QPath :: LangItem ( lang_item, self . lower_span ( span) , None ) ) ,
1199
1221
fields,
1200
1222
None ,
1201
1223
)
@@ -1390,6 +1412,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1390
1412
head_span,
1391
1413
hir:: LangItem :: IteratorNext ,
1392
1414
arena_vec ! [ self ; ref_mut_iter] ,
1415
+ None ,
1393
1416
) ;
1394
1417
let arms = arena_vec ! [ self ; none_arm, some_arm] ;
1395
1418
@@ -1418,6 +1441,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1418
1441
head_span,
1419
1442
hir:: LangItem :: IntoIterIntoIter ,
1420
1443
arena_vec ! [ self ; head] ,
1444
+ None ,
1421
1445
)
1422
1446
} ;
1423
1447
@@ -1473,6 +1497,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1473
1497
unstable_span,
1474
1498
hir:: LangItem :: TryTraitBranch ,
1475
1499
arena_vec ! [ self ; sub_expr] ,
1500
+ None ,
1476
1501
)
1477
1502
} ;
1478
1503
@@ -1629,8 +1654,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
1629
1654
span : Span ,
1630
1655
lang_item : hir:: LangItem ,
1631
1656
args : & ' hir [ hir:: Expr < ' hir > ] ,
1657
+ hir_id : Option < hir:: HirId > ,
1632
1658
) -> hir:: Expr < ' hir > {
1633
- let path = self . arena . alloc ( self . expr_lang_item_path ( span, lang_item, ThinVec :: new ( ) ) ) ;
1659
+ let path =
1660
+ self . arena . alloc ( self . expr_lang_item_path ( span, lang_item, ThinVec :: new ( ) , hir_id) ) ;
1634
1661
self . expr_call_mut ( span, path, args)
1635
1662
}
1636
1663
@@ -1639,19 +1666,21 @@ impl<'hir> LoweringContext<'_, 'hir> {
1639
1666
span : Span ,
1640
1667
lang_item : hir:: LangItem ,
1641
1668
args : & ' hir [ hir:: Expr < ' hir > ] ,
1669
+ hir_id : Option < hir:: HirId > ,
1642
1670
) -> & ' hir hir:: Expr < ' hir > {
1643
- self . arena . alloc ( self . expr_call_lang_item_fn_mut ( span, lang_item, args) )
1671
+ self . arena . alloc ( self . expr_call_lang_item_fn_mut ( span, lang_item, args, hir_id ) )
1644
1672
}
1645
1673
1646
1674
fn expr_lang_item_path (
1647
1675
& mut self ,
1648
1676
span : Span ,
1649
1677
lang_item : hir:: LangItem ,
1650
1678
attrs : AttrVec ,
1679
+ hir_id : Option < hir:: HirId > ,
1651
1680
) -> hir:: Expr < ' hir > {
1652
1681
self . expr (
1653
1682
span,
1654
- hir:: ExprKind :: Path ( hir:: QPath :: LangItem ( lang_item, self . lower_span ( span) ) ) ,
1683
+ hir:: ExprKind :: Path ( hir:: QPath :: LangItem ( lang_item, self . lower_span ( span) , hir_id ) ) ,
1655
1684
attrs,
1656
1685
)
1657
1686
}
0 commit comments