@@ -57,7 +57,7 @@ use rustc_hir as hir;
5757use rustc_hir:: def:: { DefKind , LifetimeRes , Namespace , PartialRes , PerNS , Res } ;
5858use rustc_hir:: def_id:: { LocalDefId , LocalDefIdMap , CRATE_DEF_ID , LOCAL_CRATE } ;
5959use rustc_hir:: {
60- ConstArg , GenericArg , ItemLocalMap , MissingLifetimeKind , ParamName , TraitCandidate ,
60+ ConstArg , GenericArg , HirId , ItemLocalMap , MissingLifetimeKind , ParamName , TraitCandidate ,
6161} ;
6262use rustc_index:: { Idx , IndexSlice , IndexVec } ;
6363use rustc_macros:: extension;
@@ -108,7 +108,7 @@ struct LoweringContext<'a, 'hir> {
108108
109109 /// When inside an `async` context, this is the `HirId` of the
110110 /// `task_context` local bound to the resume argument of the coroutine.
111- task_context : Option < hir :: HirId > ,
111+ task_context : Option < HirId > ,
112112
113113 /// Used to get the current `fn`'s def span to point to when using `await`
114114 /// outside of an `async fn`.
@@ -662,18 +662,16 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
662662 /// `HirIdValidator` later on, which makes sure that all `NodeId`s got mapped
663663 /// properly. Calling the method twice with the same `NodeId` is fine though.
664664 #[ instrument( level = "debug" , skip( self ) , ret) ]
665- fn lower_node_id ( & mut self , ast_node_id : NodeId ) -> hir :: HirId {
665+ fn lower_node_id ( & mut self , ast_node_id : NodeId ) -> HirId {
666666 assert_ne ! ( ast_node_id, DUMMY_NODE_ID ) ;
667667
668668 match self . node_id_to_local_id . entry ( ast_node_id) {
669- Entry :: Occupied ( o) => {
670- hir:: HirId { owner : self . current_hir_id_owner , local_id : * o. get ( ) }
671- }
669+ Entry :: Occupied ( o) => HirId { owner : self . current_hir_id_owner , local_id : * o. get ( ) } ,
672670 Entry :: Vacant ( v) => {
673671 // Generate a new `HirId`.
674672 let owner = self . current_hir_id_owner ;
675673 let local_id = self . item_local_id_counter ;
676- let hir_id = hir :: HirId { owner, local_id } ;
674+ let hir_id = HirId { owner, local_id } ;
677675
678676 v. insert ( local_id) ;
679677 self . item_local_id_counter . increment_by ( 1 ) ;
@@ -694,20 +692,20 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
694692
695693 /// Generate a new `HirId` without a backing `NodeId`.
696694 #[ instrument( level = "debug" , skip( self ) , ret) ]
697- fn next_id ( & mut self ) -> hir :: HirId {
695+ fn next_id ( & mut self ) -> HirId {
698696 let owner = self . current_hir_id_owner ;
699697 let local_id = self . item_local_id_counter ;
700698 assert_ne ! ( local_id, hir:: ItemLocalId :: ZERO ) ;
701699 self . item_local_id_counter . increment_by ( 1 ) ;
702- hir :: HirId { owner, local_id }
700+ HirId { owner, local_id }
703701 }
704702
705703 #[ instrument( level = "trace" , skip( self ) ) ]
706704 fn lower_res ( & mut self , res : Res < NodeId > ) -> Res {
707705 let res: Result < Res , ( ) > = res. apply_id ( |id| {
708706 let owner = self . current_hir_id_owner ;
709707 let local_id = self . node_id_to_local_id . get ( & id) . copied ( ) . ok_or ( ( ) ) ?;
710- Ok ( hir :: HirId { owner, local_id } )
708+ Ok ( HirId { owner, local_id } )
711709 } ) ;
712710 trace ! ( ?res) ;
713711
@@ -890,7 +888,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
890888 ret
891889 }
892890
893- fn lower_attrs ( & mut self , id : hir :: HirId , attrs : & [ Attribute ] ) -> Option < & ' hir [ Attribute ] > {
891+ fn lower_attrs ( & mut self , id : HirId , attrs : & [ Attribute ] ) -> Option < & ' hir [ Attribute ] > {
894892 if attrs. is_empty ( ) {
895893 None
896894 } else {
@@ -922,7 +920,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
922920 Attribute { kind, id : attr. id , style : attr. style , span : self . lower_span ( attr. span ) }
923921 }
924922
925- fn alias_attrs ( & mut self , id : hir :: HirId , target_id : hir :: HirId ) {
923+ fn alias_attrs ( & mut self , id : HirId , target_id : HirId ) {
926924 debug_assert_eq ! ( id. owner, self . current_hir_id_owner) ;
927925 debug_assert_eq ! ( target_id. owner, self . current_hir_id_owner) ;
928926 if let Some ( & a) = self . attrs . get ( & target_id. local_id ) {
@@ -2479,11 +2477,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24792477 self . pat ( span, hir:: PatKind :: Struct ( qpath, fields, false ) )
24802478 }
24812479
2482- fn pat_ident ( & mut self , span : Span , ident : Ident ) -> ( & ' hir hir:: Pat < ' hir > , hir :: HirId ) {
2480+ fn pat_ident ( & mut self , span : Span , ident : Ident ) -> ( & ' hir hir:: Pat < ' hir > , HirId ) {
24832481 self . pat_ident_binding_mode ( span, ident, hir:: BindingAnnotation :: NONE )
24842482 }
24852483
2486- fn pat_ident_mut ( & mut self , span : Span , ident : Ident ) -> ( hir:: Pat < ' hir > , hir :: HirId ) {
2484+ fn pat_ident_mut ( & mut self , span : Span , ident : Ident ) -> ( hir:: Pat < ' hir > , HirId ) {
24872485 self . pat_ident_binding_mode_mut ( span, ident, hir:: BindingAnnotation :: NONE )
24882486 }
24892487
@@ -2492,7 +2490,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24922490 span : Span ,
24932491 ident : Ident ,
24942492 bm : hir:: BindingAnnotation ,
2495- ) -> ( & ' hir hir:: Pat < ' hir > , hir :: HirId ) {
2493+ ) -> ( & ' hir hir:: Pat < ' hir > , HirId ) {
24962494 let ( pat, hir_id) = self . pat_ident_binding_mode_mut ( span, ident, bm) ;
24972495 ( self . arena . alloc ( pat) , hir_id)
24982496 }
@@ -2502,7 +2500,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
25022500 span : Span ,
25032501 ident : Ident ,
25042502 bm : hir:: BindingAnnotation ,
2505- ) -> ( hir:: Pat < ' hir > , hir :: HirId ) {
2503+ ) -> ( hir:: Pat < ' hir > , HirId ) {
25062504 let hir_id = self . next_id ( ) ;
25072505
25082506 (
@@ -2534,12 +2532,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
25342532 }
25352533 }
25362534
2537- fn ty_path (
2538- & mut self ,
2539- mut hir_id : hir:: HirId ,
2540- span : Span ,
2541- qpath : hir:: QPath < ' hir > ,
2542- ) -> hir:: Ty < ' hir > {
2535+ fn ty_path ( & mut self , mut hir_id : HirId , span : Span , qpath : hir:: QPath < ' hir > ) -> hir:: Ty < ' hir > {
25432536 let kind = match qpath {
25442537 hir:: QPath :: Resolved ( None , path) => {
25452538 // Turn trait object paths into `TyKind::TraitObject` instead.
0 commit comments