@@ -17,6 +17,7 @@ use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId};
17
17
use rustc_hir:: * ;
18
18
use rustc_macros:: { Decodable , Encodable , HashStable } ;
19
19
use rustc_span:: { ErrorGuaranteed , ExpnId } ;
20
+ use tracing:: debug;
20
21
21
22
/// Gather the LocalDefId for each item-like within a module, including items contained within
22
23
/// bodies. The Ids are in visitor order. This is used to partition a pass between modules.
@@ -163,10 +164,15 @@ pub fn provide(providers: &mut Providers) {
163
164
providers. hir_crate_items = map:: hir_crate_items;
164
165
providers. crate_hash = map:: crate_hash;
165
166
providers. hir_module_items = map:: hir_module_items;
166
- providers. local_def_id_to_hir_id = |tcx, def_id| match tcx. hir_crate ( ( ) ) . owners [ def_id] {
167
- MaybeOwner :: Owner ( _) => HirId :: make_owner ( def_id) ,
168
- MaybeOwner :: NonOwner ( hir_id) => hir_id,
169
- MaybeOwner :: Phantom => bug ! ( "No HirId for {:?}" , def_id) ,
167
+ providers. local_def_id_to_hir_id = |tcx, def_id| {
168
+ if !def_id. is_top_level_module ( ) {
169
+ debug ! ( "ATTN! {:?} {:?}" , tcx. def_kind( def_id) , tcx. parent( def_id. into( ) ) ) ;
170
+ }
171
+ match tcx. hir_crate ( ( ) ) . owners [ def_id] {
172
+ MaybeOwner :: Owner ( _) => HirId :: make_owner ( def_id) ,
173
+ MaybeOwner :: NonOwner ( hir_id) => hir_id,
174
+ MaybeOwner :: Phantom => bug ! ( "No HirId for {:?}" , def_id) ,
175
+ }
170
176
} ;
171
177
providers. opt_hir_owner_nodes =
172
178
|tcx, id| tcx. hir_crate ( ( ) ) . owners . get ( id) ?. as_owner ( ) . map ( |i| & i. nodes ) ;
0 commit comments