@@ -70,44 +70,32 @@ impl<'a, 'hir> ItemLowerer<'a, 'hir> {
70
70
}
71
71
}
72
72
73
- pub ( super ) fn lower_node ( & mut self , def_id : LocalDefId ) -> hir :: MaybeOwner < ' hir > {
73
+ pub ( super ) fn lower_node ( & mut self , def_id : LocalDefId ) {
74
74
let owner = self . owners . ensure_contains_elem ( def_id, || hir:: MaybeOwner :: Phantom ) ;
75
75
if let hir:: MaybeOwner :: Phantom = owner {
76
76
let node = self . ast_index [ def_id] ;
77
77
match node {
78
78
AstOwner :: NonOwner => { }
79
- AstOwner :: Crate ( c) => self . lower_crate ( c) ,
80
- AstOwner :: Item ( item) => self . lower_item ( item) ,
81
- AstOwner :: AssocItem ( item, ctxt) => self . lower_assoc_item ( item, ctxt) ,
82
- AstOwner :: ForeignItem ( item) => self . lower_foreign_item ( item) ,
79
+ AstOwner :: Crate ( c) => {
80
+ debug_assert_eq ! ( self . resolver. node_id_to_def_id[ & CRATE_NODE_ID ] , CRATE_DEF_ID ) ;
81
+ self . with_lctx ( CRATE_NODE_ID , |lctx| {
82
+ let module = lctx. lower_mod ( & c. items , & c. spans ) ;
83
+ // FIXME(jdonszelman): is dummy span ever a problem here?
84
+ lctx. lower_attrs ( hir:: CRATE_HIR_ID , & c. attrs , DUMMY_SP ) ;
85
+ hir:: OwnerNode :: Crate ( module)
86
+ } )
87
+ }
88
+ AstOwner :: Item ( item) => {
89
+ self . with_lctx ( item. id , |lctx| hir:: OwnerNode :: Item ( lctx. lower_item ( item) ) )
90
+ }
91
+ AstOwner :: AssocItem ( item, ctxt) => {
92
+ self . with_lctx ( item. id , |lctx| lctx. lower_assoc_item ( item, ctxt) )
93
+ }
94
+ AstOwner :: ForeignItem ( item) => self . with_lctx ( item. id , |lctx| {
95
+ hir:: OwnerNode :: ForeignItem ( lctx. lower_foreign_item ( item) )
96
+ } ) ,
83
97
}
84
98
}
85
-
86
- self . owners [ def_id]
87
- }
88
-
89
- #[ instrument( level = "debug" , skip( self , c) ) ]
90
- fn lower_crate ( & mut self , c : & Crate ) {
91
- debug_assert_eq ! ( self . resolver. node_id_to_def_id[ & CRATE_NODE_ID ] , CRATE_DEF_ID ) ;
92
- self . with_lctx ( CRATE_NODE_ID , |lctx| {
93
- let module = lctx. lower_mod ( & c. items , & c. spans ) ;
94
- // FIXME(jdonszelman): is dummy span ever a problem here?
95
- lctx. lower_attrs ( hir:: CRATE_HIR_ID , & c. attrs , DUMMY_SP ) ;
96
- hir:: OwnerNode :: Crate ( module)
97
- } )
98
- }
99
-
100
- #[ instrument( level = "debug" , skip( self ) ) ]
101
- fn lower_item ( & mut self , item : & Item ) {
102
- self . with_lctx ( item. id , |lctx| hir:: OwnerNode :: Item ( lctx. lower_item ( item) ) )
103
- }
104
-
105
- fn lower_assoc_item ( & mut self , item : & AssocItem , ctxt : AssocCtxt ) {
106
- self . with_lctx ( item. id , |lctx| lctx. lower_assoc_item ( item, ctxt) )
107
- }
108
-
109
- fn lower_foreign_item ( & mut self , item : & ForeignItem ) {
110
- self . with_lctx ( item. id , |lctx| hir:: OwnerNode :: ForeignItem ( lctx. lower_foreign_item ( item) ) )
111
99
}
112
100
}
113
101
0 commit comments