@@ -479,8 +479,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
479479 expr : & ' hir hir:: Expr < ' hir > ,
480480 overall_span : Span ,
481481 ) -> & ' 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+ ) ) ;
484488 self . expr_call ( overall_span, constructor, std:: slice:: from_ref ( expr) )
485489 }
486490
@@ -584,8 +588,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
584588 // `future::from_generator`:
585589 let unstable_span =
586590 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+ ) ;
589597
590598 // `future::from_generator(generator)`:
591599 hir:: ExprKind :: Call ( self . arena . alloc ( gen_future) , arena_vec ! [ self ; generator] )
@@ -657,16 +665,19 @@ impl<'hir> LoweringContext<'_, 'hir> {
657665 span,
658666 hir:: LangItem :: PinNewUnchecked ,
659667 arena_vec ! [ self ; ref_mut_pinned] ,
668+ Some ( expr. hir_id ) ,
660669 ) ;
661670 let get_context = self . expr_call_lang_item_fn_mut (
662671 gen_future_span,
663672 hir:: LangItem :: GetContext ,
664673 arena_vec ! [ self ; task_context] ,
674+ Some ( expr. hir_id ) ,
665675 ) ;
666676 let call = self . expr_call_lang_item_fn (
667677 span,
668678 hir:: LangItem :: FuturePoll ,
669679 arena_vec ! [ self ; new_unchecked, get_context] ,
680+ Some ( expr. hir_id ) ,
670681 ) ;
671682 self . arena . alloc ( self . expr_unsafe ( call) )
672683 } ;
@@ -679,7 +690,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
679690 let ( x_pat, x_pat_hid) = self . pat_ident ( span, x_ident) ;
680691 let x_expr = self . expr_ident ( span, x_ident, x_pat_hid) ;
681692 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+ ) ;
683699 let break_x = self . with_loop_scope ( loop_node_id, move |this| {
684700 let expr_break =
685701 hir:: ExprKind :: Break ( this. lower_loop_destination ( None ) , Some ( x_expr) ) ;
@@ -690,7 +706,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
690706
691707 // `::std::task::Poll::Pending => {}`
692708 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+ ) ;
694715 let empty_block = self . expr_block_empty ( span) ;
695716 self . arm ( pending_pat, empty_block)
696717 } ;
@@ -1161,7 +1182,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
11611182 fn lower_expr_range_closed ( & mut self , span : Span , e1 : & Expr , e2 : & Expr ) -> hir:: ExprKind < ' hir > {
11621183 let e1 = self . lower_expr_mut ( e1) ;
11631184 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 ) ;
11651187 let fn_expr =
11661188 self . arena . alloc ( self . expr ( span, hir:: ExprKind :: Path ( fn_path) , ThinVec :: new ( ) ) ) ;
11671189 hir:: ExprKind :: Call ( fn_expr, arena_vec ! [ self ; e1, e2] )
@@ -1195,7 +1217,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
11951217 ) ;
11961218
11971219 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 ) ) ,
11991221 fields,
12001222 None ,
12011223 )
@@ -1390,6 +1412,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
13901412 head_span,
13911413 hir:: LangItem :: IteratorNext ,
13921414 arena_vec ! [ self ; ref_mut_iter] ,
1415+ None ,
13931416 ) ;
13941417 let arms = arena_vec ! [ self ; none_arm, some_arm] ;
13951418
@@ -1418,6 +1441,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14181441 head_span,
14191442 hir:: LangItem :: IntoIterIntoIter ,
14201443 arena_vec ! [ self ; head] ,
1444+ None ,
14211445 )
14221446 } ;
14231447
@@ -1473,6 +1497,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14731497 unstable_span,
14741498 hir:: LangItem :: TryTraitBranch ,
14751499 arena_vec ! [ self ; sub_expr] ,
1500+ None ,
14761501 )
14771502 } ;
14781503
@@ -1629,8 +1654,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
16291654 span : Span ,
16301655 lang_item : hir:: LangItem ,
16311656 args : & ' hir [ hir:: Expr < ' hir > ] ,
1657+ hir_id : Option < hir:: HirId > ,
16321658 ) -> 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) ) ;
16341661 self . expr_call_mut ( span, path, args)
16351662 }
16361663
@@ -1639,19 +1666,21 @@ impl<'hir> LoweringContext<'_, 'hir> {
16391666 span : Span ,
16401667 lang_item : hir:: LangItem ,
16411668 args : & ' hir [ hir:: Expr < ' hir > ] ,
1669+ hir_id : Option < hir:: HirId > ,
16421670 ) -> & ' 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 ) )
16441672 }
16451673
16461674 fn expr_lang_item_path (
16471675 & mut self ,
16481676 span : Span ,
16491677 lang_item : hir:: LangItem ,
16501678 attrs : AttrVec ,
1679+ hir_id : Option < hir:: HirId > ,
16511680 ) -> hir:: Expr < ' hir > {
16521681 self . expr (
16531682 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 ) ) ,
16551684 attrs,
16561685 )
16571686 }
0 commit comments