@@ -57,7 +57,7 @@ use rustc_hir as hir;
57
57
use rustc_hir:: def:: { DefKind , LifetimeRes , Namespace , PartialRes , PerNS , Res } ;
58
58
use rustc_hir:: def_id:: { LocalDefId , LocalDefIdMap , CRATE_DEF_ID , LOCAL_CRATE } ;
59
59
use rustc_hir:: {
60
- ConstArg , GenericArg , ItemLocalMap , MissingLifetimeKind , ParamName , TraitCandidate ,
60
+ ConstArg , GenericArg , HirId , ItemLocalMap , MissingLifetimeKind , ParamName , TraitCandidate ,
61
61
} ;
62
62
use rustc_index:: { Idx , IndexSlice , IndexVec } ;
63
63
use rustc_macros:: extension;
@@ -108,7 +108,7 @@ struct LoweringContext<'a, 'hir> {
108
108
109
109
/// When inside an `async` context, this is the `HirId` of the
110
110
/// `task_context` local bound to the resume argument of the coroutine.
111
- task_context : Option < hir :: HirId > ,
111
+ task_context : Option < HirId > ,
112
112
113
113
/// Used to get the current `fn`'s def span to point to when using `await`
114
114
/// outside of an `async fn`.
@@ -662,18 +662,16 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
662
662
/// `HirIdValidator` later on, which makes sure that all `NodeId`s got mapped
663
663
/// properly. Calling the method twice with the same `NodeId` is fine though.
664
664
#[ 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 {
666
666
assert_ne ! ( ast_node_id, DUMMY_NODE_ID ) ;
667
667
668
668
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 ( ) } ,
672
670
Entry :: Vacant ( v) => {
673
671
// Generate a new `HirId`.
674
672
let owner = self . current_hir_id_owner ;
675
673
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 } ;
677
675
678
676
v. insert ( local_id) ;
679
677
self . item_local_id_counter . increment_by ( 1 ) ;
@@ -694,20 +692,20 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
694
692
695
693
/// Generate a new `HirId` without a backing `NodeId`.
696
694
#[ instrument( level = "debug" , skip( self ) , ret) ]
697
- fn next_id ( & mut self ) -> hir :: HirId {
695
+ fn next_id ( & mut self ) -> HirId {
698
696
let owner = self . current_hir_id_owner ;
699
697
let local_id = self . item_local_id_counter ;
700
698
assert_ne ! ( local_id, hir:: ItemLocalId :: ZERO ) ;
701
699
self . item_local_id_counter . increment_by ( 1 ) ;
702
- hir :: HirId { owner, local_id }
700
+ HirId { owner, local_id }
703
701
}
704
702
705
703
#[ instrument( level = "trace" , skip( self ) ) ]
706
704
fn lower_res ( & mut self , res : Res < NodeId > ) -> Res {
707
705
let res: Result < Res , ( ) > = res. apply_id ( |id| {
708
706
let owner = self . current_hir_id_owner ;
709
707
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 } )
711
709
} ) ;
712
710
trace ! ( ?res) ;
713
711
@@ -890,7 +888,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
890
888
ret
891
889
}
892
890
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 ] > {
894
892
if attrs. is_empty ( ) {
895
893
None
896
894
} else {
@@ -922,7 +920,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
922
920
Attribute { kind, id : attr. id , style : attr. style , span : self . lower_span ( attr. span ) }
923
921
}
924
922
925
- fn alias_attrs ( & mut self , id : hir :: HirId , target_id : hir :: HirId ) {
923
+ fn alias_attrs ( & mut self , id : HirId , target_id : HirId ) {
926
924
debug_assert_eq ! ( id. owner, self . current_hir_id_owner) ;
927
925
debug_assert_eq ! ( target_id. owner, self . current_hir_id_owner) ;
928
926
if let Some ( & a) = self . attrs . get ( & target_id. local_id ) {
@@ -2479,11 +2477,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2479
2477
self . pat ( span, hir:: PatKind :: Struct ( qpath, fields, false ) )
2480
2478
}
2481
2479
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 ) {
2483
2481
self . pat_ident_binding_mode ( span, ident, hir:: BindingAnnotation :: NONE )
2484
2482
}
2485
2483
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 ) {
2487
2485
self . pat_ident_binding_mode_mut ( span, ident, hir:: BindingAnnotation :: NONE )
2488
2486
}
2489
2487
@@ -2492,7 +2490,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2492
2490
span : Span ,
2493
2491
ident : Ident ,
2494
2492
bm : hir:: BindingAnnotation ,
2495
- ) -> ( & ' hir hir:: Pat < ' hir > , hir :: HirId ) {
2493
+ ) -> ( & ' hir hir:: Pat < ' hir > , HirId ) {
2496
2494
let ( pat, hir_id) = self . pat_ident_binding_mode_mut ( span, ident, bm) ;
2497
2495
( self . arena . alloc ( pat) , hir_id)
2498
2496
}
@@ -2502,7 +2500,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2502
2500
span : Span ,
2503
2501
ident : Ident ,
2504
2502
bm : hir:: BindingAnnotation ,
2505
- ) -> ( hir:: Pat < ' hir > , hir :: HirId ) {
2503
+ ) -> ( hir:: Pat < ' hir > , HirId ) {
2506
2504
let hir_id = self . next_id ( ) ;
2507
2505
2508
2506
(
@@ -2534,12 +2532,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2534
2532
}
2535
2533
}
2536
2534
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 > {
2543
2536
let kind = match qpath {
2544
2537
hir:: QPath :: Resolved ( None , path) => {
2545
2538
// Turn trait object paths into `TyKind::TraitObject` instead.
0 commit comments