@@ -181,19 +181,20 @@ pub fn provide(providers: &mut Providers) {
181
181
providers. hir_crate_items = map:: hir_crate_items;
182
182
providers. crate_hash = map:: crate_hash;
183
183
providers. hir_module_items = map:: hir_module_items;
184
- providers. local_def_id_to_hir_id = |tcx, def_id| match tcx. hir_crate ( ( ) ) . owners [ def_id] {
184
+ providers. hir_owner = |tcx, def_id| tcx. hir_crate ( ( ) ) . owners [ def_id] ;
185
+ providers. local_def_id_to_hir_id = |tcx, def_id| match tcx. hir_owner ( def_id) {
185
186
MaybeOwner :: Owner ( _) => HirId :: make_owner ( def_id) ,
186
187
MaybeOwner :: NonOwner ( hir_id) => hir_id,
187
188
MaybeOwner :: Phantom => bug ! ( "No HirId for {:?}" , def_id) ,
188
189
} ;
189
- providers. opt_hir_owner_nodes =
190
- |tcx, id| tcx. hir_crate ( ( ) ) . owners . get ( id) ?. as_owner ( ) . map ( |i| & i. nodes ) ;
190
+ providers. opt_hir_owner_nodes = |tcx, id| tcx. hir_owner ( id) . as_owner ( ) . map ( |i| & i. nodes ) ;
191
191
providers. hir_owner_parent = |tcx, owner_id| {
192
192
tcx. opt_local_parent ( owner_id. def_id ) . map_or ( CRATE_HIR_ID , |parent_def_id| {
193
193
let parent_owner_id = tcx. local_def_id_to_hir_id ( parent_def_id) . owner ;
194
194
HirId {
195
195
owner : parent_owner_id,
196
- local_id : tcx. hir_crate ( ( ) ) . owners [ parent_owner_id. def_id ]
196
+ local_id : tcx
197
+ . hir_owner ( parent_owner_id. def_id )
197
198
. unwrap ( )
198
199
. parenting
199
200
. get ( & owner_id. def_id )
@@ -202,9 +203,8 @@ pub fn provide(providers: &mut Providers) {
202
203
}
203
204
} )
204
205
} ;
205
- providers. hir_attr_map = |tcx, id| {
206
- tcx. hir_crate ( ( ) ) . owners [ id. def_id ] . as_owner ( ) . map_or ( AttributeMap :: EMPTY , |o| & o. attrs )
207
- } ;
206
+ providers. hir_attr_map =
207
+ |tcx, id| tcx. hir_owner ( id. def_id ) . as_owner ( ) . map_or ( AttributeMap :: EMPTY , |o| & o. attrs ) ;
208
208
providers. def_span = |tcx, def_id| tcx. hir ( ) . span ( tcx. local_def_id_to_hir_id ( def_id) ) ;
209
209
providers. def_ident_span = |tcx, def_id| {
210
210
let hir_id = tcx. local_def_id_to_hir_id ( def_id) ;
@@ -235,7 +235,6 @@ pub fn provide(providers: &mut Providers) {
235
235
providers. all_local_trait_impls = |tcx, ( ) | & tcx. resolutions ( ( ) ) . trait_impls ;
236
236
providers. expn_that_defined =
237
237
|tcx, id| tcx. resolutions ( ( ) ) . expn_that_defined . get ( & id) . copied ( ) . unwrap_or ( ExpnId :: root ( ) ) ;
238
- providers. in_scope_traits_map = |tcx, id| {
239
- tcx. hir_crate ( ( ) ) . owners [ id. def_id ] . as_owner ( ) . map ( |owner_info| & owner_info. trait_map )
240
- } ;
238
+ providers. in_scope_traits_map =
239
+ |tcx, id| tcx. hir_owner ( id. def_id ) . as_owner ( ) . map ( |owner_info| & owner_info. trait_map ) ;
241
240
}
0 commit comments