@@ -7,6 +7,7 @@ use rustc_ast::*;
77use rustc_data_structures:: stack:: ensure_sufficient_stack;
88use rustc_errors:: msg;
99use rustc_hir as hir;
10+ use rustc_hir:: attrs:: lang_items:: LangItem ;
1011use rustc_hir:: def:: { DefKind , Res } ;
1112use rustc_hir:: { HirId , Target , find_attr} ;
1213use rustc_middle:: span_bug;
@@ -717,7 +718,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
717718
718719 // `::std::ops::Try::from_output($tail_expr)`
719720 block. expr = Some ( this. wrap_in_try_constructor (
720- hir :: LangItem :: TryTraitFromOutput ,
721+ LangItem :: TryTraitFromOutput ,
721722 try_span,
722723 tail_expr,
723724 ok_wrapped_span,
@@ -737,7 +738,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
737738
738739 fn wrap_in_try_constructor (
739740 & mut self ,
740- lang_item : hir :: LangItem ,
741+ lang_item : LangItem ,
741742 method_span : Span ,
742743 expr : & ' hir hir:: Expr < ' hir > ,
743744 overall_span : Span ,
@@ -836,8 +837,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
836837 self . lower_span ( span) ,
837838 Some ( Arc :: clone ( & self . allow_gen_future ) ) ,
838839 ) ;
839- let resume_ty =
840- self . make_lang_item_qpath ( hir:: LangItem :: ResumeTy , unstable_span, None ) ;
840+ let resume_ty = self . make_lang_item_qpath ( LangItem :: ResumeTy , unstable_span, None ) ;
841841 let input_ty = hir:: Ty {
842842 hir_id : self . next_id ( ) ,
843843 kind : hir:: TyKind :: Path ( resume_ty) ,
@@ -1036,23 +1036,23 @@ impl<'hir> LoweringContext<'_, 'hir> {
10361036
10371037 let new_unchecked = self . expr_call_lang_item_fn_mut (
10381038 span,
1039- hir :: LangItem :: PinNewUnchecked ,
1039+ LangItem :: PinNewUnchecked ,
10401040 arena_vec ! [ self ; ref_mut_awaitee] ,
10411041 ) ;
10421042 let get_context = self . expr_call_lang_item_fn_mut (
10431043 gen_future_span,
1044- hir :: LangItem :: GetContext ,
1044+ LangItem :: GetContext ,
10451045 arena_vec ! [ self ; task_context] ,
10461046 ) ;
10471047 let call = match await_kind {
10481048 FutureKind :: Future => self . expr_call_lang_item_fn (
10491049 span,
1050- hir :: LangItem :: FuturePoll ,
1050+ LangItem :: FuturePoll ,
10511051 arena_vec ! [ self ; new_unchecked, get_context] ,
10521052 ) ,
10531053 FutureKind :: AsyncIterator => self . expr_call_lang_item_fn (
10541054 span,
1055- hir :: LangItem :: AsyncIteratorPollNext ,
1055+ LangItem :: AsyncIteratorPollNext ,
10561056 arena_vec ! [ self ; new_unchecked, get_context] ,
10571057 ) ,
10581058 } ;
@@ -1067,7 +1067,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10671067 let ( x_pat, x_pat_hid) = self . pat_ident ( gen_future_span, x_ident) ;
10681068 let x_expr = self . expr_ident ( gen_future_span, x_ident, x_pat_hid) ;
10691069 let ready_field = self . single_pat_field ( gen_future_span, x_pat) ;
1070- let ready_pat = self . pat_lang_item_variant ( span, hir :: LangItem :: PollReady , ready_field) ;
1070+ let ready_pat = self . pat_lang_item_variant ( span, LangItem :: PollReady , ready_field) ;
10711071 let break_x = self . with_loop_scope ( loop_hir_id, move |this| {
10721072 let expr_break =
10731073 hir:: ExprKind :: Break ( this. lower_loop_destination ( None ) , Some ( x_expr) ) ;
@@ -1078,7 +1078,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10781078
10791079 // `::std::task::Poll::Pending => {}`
10801080 let pending_arm = {
1081- let pending_pat = self . pat_lang_item_variant ( span, hir :: LangItem :: PollPending , & [ ] ) ;
1081+ let pending_pat = self . pat_lang_item_variant ( span, LangItem :: PollPending , & [ ] ) ;
10821082 let empty_block = self . expr_block_empty ( span) ;
10831083 self . arm ( pending_pat, empty_block, span)
10841084 } ;
@@ -1098,7 +1098,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10981098 // async gen - task_context = yield ASYNC_GEN_PENDING;
10991099 let yield_stmt = {
11001100 let yielded = if is_async_gen {
1101- self . arena . alloc ( self . expr_lang_item_path ( span, hir :: LangItem :: AsyncGenPending ) )
1101+ self . arena . alloc ( self . expr_lang_item_path ( span, LangItem :: AsyncGenPending ) )
11021102 } else {
11031103 self . expr_unit ( span)
11041104 } ;
@@ -1140,7 +1140,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
11401140 let into_future_expr = match await_kind {
11411141 FutureKind :: Future => self . expr_call_lang_item_fn (
11421142 span,
1143- hir :: LangItem :: IntoFutureIntoFuture ,
1143+ LangItem :: IntoFutureIntoFuture ,
11441144 arena_vec ! [ self ; * expr] ,
11451145 ) ,
11461146 // Not needed for `for await` because we expect to have already called
@@ -1444,7 +1444,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14441444 fn lower_expr_range_closed ( & mut self , span : Span , e1 : & Expr , e2 : & Expr ) -> hir:: ExprKind < ' hir > {
14451445 let e1 = self . lower_expr_mut ( e1) ;
14461446 let e2 = self . lower_expr_mut ( e2) ;
1447- let fn_path = self . make_lang_item_qpath ( hir :: LangItem :: RangeInclusiveNew , span, None ) ;
1447+ let fn_path = self . make_lang_item_qpath ( LangItem :: RangeInclusiveNew , span, None ) ;
14481448 let fn_expr = self . arena . alloc ( self . expr ( span, hir:: ExprKind :: Path ( fn_path) ) ) ;
14491449 hir:: ExprKind :: Call ( fn_expr, arena_vec ! [ self ; e1, e2] )
14501450 }
@@ -1459,32 +1459,32 @@ impl<'hir> LoweringContext<'_, 'hir> {
14591459 use rustc_ast:: RangeLimits :: * ;
14601460
14611461 let lang_item = match ( e1, e2, lims) {
1462- ( None , None , HalfOpen ) => hir :: LangItem :: RangeFull ,
1462+ ( None , None , HalfOpen ) => LangItem :: RangeFull ,
14631463 ( Some ( ..) , None , HalfOpen ) => {
14641464 if self . tcx . features ( ) . new_range ( ) {
1465- hir :: LangItem :: RangeFromCopy
1465+ LangItem :: RangeFromCopy
14661466 } else {
1467- hir :: LangItem :: RangeFrom
1467+ LangItem :: RangeFrom
14681468 }
14691469 }
1470- ( None , Some ( ..) , HalfOpen ) => hir :: LangItem :: RangeTo ,
1470+ ( None , Some ( ..) , HalfOpen ) => LangItem :: RangeTo ,
14711471 ( Some ( ..) , Some ( ..) , HalfOpen ) => {
14721472 if self . tcx . features ( ) . new_range ( ) {
1473- hir :: LangItem :: RangeCopy
1473+ LangItem :: RangeCopy
14741474 } else {
1475- hir :: LangItem :: Range
1475+ LangItem :: Range
14761476 }
14771477 }
14781478 ( None , Some ( ..) , Closed ) => {
14791479 if self . tcx . features ( ) . new_range ( ) {
1480- hir :: LangItem :: RangeToInclusiveCopy
1480+ LangItem :: RangeToInclusiveCopy
14811481 } else {
1482- hir :: LangItem :: RangeToInclusive
1482+ LangItem :: RangeToInclusive
14831483 }
14841484 }
14851485 ( Some ( e1) , Some ( e2) , Closed ) => {
14861486 if self . tcx . features ( ) . new_range ( ) {
1487- hir :: LangItem :: RangeInclusiveCopy
1487+ LangItem :: RangeInclusiveCopy
14881488 } else {
14891489 return self . lower_expr_range_closed ( span, e1, e2) ;
14901490 }
@@ -1494,12 +1494,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
14941494 match start {
14951495 Some ( ..) => {
14961496 if self . tcx . features ( ) . new_range ( ) {
1497- hir :: LangItem :: RangeFromCopy
1497+ LangItem :: RangeFromCopy
14981498 } else {
1499- hir :: LangItem :: RangeFrom
1499+ LangItem :: RangeFrom
15001500 }
15011501 }
1502- None => hir :: LangItem :: RangeFull ,
1502+ None => LangItem :: RangeFull ,
15031503 }
15041504 }
15051505 } ;
@@ -1511,7 +1511,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
15111511 (
15121512 if matches ! (
15131513 lang_item,
1514- hir :: LangItem :: RangeInclusiveCopy | hir :: LangItem :: RangeToInclusiveCopy
1514+ LangItem :: RangeInclusiveCopy | LangItem :: RangeToInclusiveCopy
15151515 ) {
15161516 sym:: last
15171517 } else {
@@ -1691,7 +1691,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
16911691 ) ;
16921692 let wrapped_yielded = self . expr_call_lang_item_fn (
16931693 desugar_span,
1694- hir :: LangItem :: AsyncGenReady ,
1694+ LangItem :: AsyncGenReady ,
16951695 std:: slice:: from_ref ( yielded) ,
16961696 ) ;
16971697 let yield_expr = self . arena . alloc (
@@ -1781,7 +1781,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
17811781 let ref_mut_iter = self . expr_mut_addr_of ( head_span, iter) ;
17821782 self . expr_call_lang_item_fn (
17831783 head_span,
1784- hir :: LangItem :: IteratorNext ,
1784+ LangItem :: IteratorNext ,
17851785 arena_vec ! [ self ; ref_mut_iter] ,
17861786 )
17871787 }
@@ -1796,7 +1796,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
17961796 // `Pin::new_unchecked(...)`
17971797 let iter = self . arena . alloc ( self . expr_call_lang_item_fn_mut (
17981798 head_span,
1799- hir :: LangItem :: PinNewUnchecked ,
1799+ LangItem :: PinNewUnchecked ,
18001800 arena_vec ! [ self ; iter] ,
18011801 ) ) ;
18021802 // `unsafe { ... }`
@@ -1831,7 +1831,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
18311831 // `::std::iter::IntoIterator::into_iter(<head>)`
18321832 let into_iter_expr = self . expr_call_lang_item_fn (
18331833 head_span,
1834- hir :: LangItem :: IntoIterIntoIter ,
1834+ LangItem :: IntoIterIntoIter ,
18351835 arena_vec ! [ self ; head] ,
18361836 ) ;
18371837
@@ -1851,7 +1851,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
18511851 // `Pin::new_unchecked(...)`
18521852 let iter = self . arena . alloc ( self . expr_call_lang_item_fn_mut (
18531853 head_span,
1854- hir :: LangItem :: PinNewUnchecked ,
1854+ LangItem :: PinNewUnchecked ,
18551855 arena_vec ! [ self ; iter] ,
18561856 ) ) ;
18571857 // `unsafe { ... }`
@@ -1866,7 +1866,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
18661866 // `::core::async_iter::IntoAsyncIterator::into_async_iter(<head>)`
18671867 let iter = self . expr_call_lang_item_fn (
18681868 head_span,
1869- hir :: LangItem :: IntoAsyncIterIntoIter ,
1869+ LangItem :: IntoAsyncIterIntoIter ,
18701870 arena_vec ! [ self ; head] ,
18711871 ) ;
18721872 let iter_arm = self . arm ( async_iter_pat, inner_match_expr, for_span) ;
@@ -1922,7 +1922,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
19221922
19231923 self . expr_call_lang_item_fn (
19241924 unstable_span,
1925- hir :: LangItem :: TryTraitBranch ,
1925+ LangItem :: TryTraitBranch ,
19261926 arena_vec ! [ self ; sub_expr] ,
19271927 )
19281928 } ;
@@ -1949,13 +1949,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
19491949
19501950 let ( constructor_item, target_id) = match self . try_block_scope {
19511951 TryBlockScope :: Function => {
1952- ( hir :: LangItem :: TryTraitFromResidual , Err ( hir:: LoopIdError :: OutsideLoopScope ) )
1952+ ( LangItem :: TryTraitFromResidual , Err ( hir:: LoopIdError :: OutsideLoopScope ) )
19531953 }
19541954 TryBlockScope :: Homogeneous ( block_id) => {
1955- ( hir :: LangItem :: ResidualIntoTryType , Ok ( block_id) )
1955+ ( LangItem :: ResidualIntoTryType , Ok ( block_id) )
19561956 }
19571957 TryBlockScope :: Heterogeneous ( block_id) => {
1958- ( hir :: LangItem :: TryTraitFromResidual , Ok ( block_id) )
1958+ ( LangItem :: TryTraitFromResidual , Ok ( block_id) )
19591959 }
19601960 } ;
19611961 let from_residual_expr = self . wrap_in_try_constructor (
@@ -2013,7 +2013,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
20132013 ) ;
20142014
20152015 let from_yeet_expr = self . wrap_in_try_constructor (
2016- hir :: LangItem :: TryTraitFromYeet ,
2016+ LangItem :: TryTraitFromYeet ,
20172017 unstable_span,
20182018 yeeted_expr,
20192019 yeeted_span,
@@ -2140,7 +2140,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
21402140 pub ( super ) fn expr_enum_variant_lang_item (
21412141 & mut self ,
21422142 span : Span ,
2143- lang_item : hir :: LangItem ,
2143+ lang_item : LangItem ,
21442144 fields : & ' hir [ hir:: Expr < ' hir > ] ,
21452145 ) -> hir:: Expr < ' hir > {
21462146 let path = self . arena . alloc ( self . make_lang_item_qpath ( lang_item, span, None ) ) ;
@@ -2159,7 +2159,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
21592159 pub ( super ) fn expr_call_lang_item_fn_mut (
21602160 & mut self ,
21612161 span : Span ,
2162- lang_item : hir :: LangItem ,
2162+ lang_item : LangItem ,
21632163 args : & ' hir [ hir:: Expr < ' hir > ] ,
21642164 ) -> hir:: Expr < ' hir > {
21652165 let path = self . arena . alloc ( self . expr_lang_item_path ( span, lang_item) ) ;
@@ -2169,7 +2169,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
21692169 pub ( super ) fn expr_call_lang_item_fn (
21702170 & mut self ,
21712171 span : Span ,
2172- lang_item : hir :: LangItem ,
2172+ lang_item : LangItem ,
21732173 args : & ' hir [ hir:: Expr < ' hir > ] ,
21742174 ) -> & ' hir hir:: Expr < ' hir > {
21752175 self . arena . alloc ( self . expr_call_lang_item_fn_mut ( span, lang_item, args) )
@@ -2178,7 +2178,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
21782178 pub ( super ) fn expr_lang_item_path (
21792179 & mut self ,
21802180 span : Span ,
2181- lang_item : hir :: LangItem ,
2181+ lang_item : LangItem ,
21822182 ) -> hir:: Expr < ' hir > {
21832183 let qpath = self . make_lang_item_qpath ( lang_item, self . lower_span ( span) , None ) ;
21842184 self . expr ( span, hir:: ExprKind :: Path ( qpath) )
@@ -2188,7 +2188,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
21882188 pub ( super ) fn expr_lang_item_type_relative (
21892189 & mut self ,
21902190 span : Span ,
2191- lang_item : hir :: LangItem ,
2191+ lang_item : LangItem ,
21922192 name : Symbol ,
21932193 ) -> hir:: Expr < ' hir > {
21942194 let qpath = self . make_lang_item_qpath ( lang_item, self . lower_span ( span) , None ) ;
0 commit comments