@@ -17,6 +17,7 @@ use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId};
1717use rustc_hir:: * ;
1818use rustc_macros:: { Decodable , Encodable , HashStable } ;
1919use rustc_span:: { ErrorGuaranteed , ExpnId } ;
20+ use tracing:: debug;
2021
2122/// Gather the LocalDefId for each item-like within a module, including items contained within
2223/// 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) {
163164 providers. hir_crate_items = map:: hir_crate_items;
164165 providers. crate_hash = map:: crate_hash;
165166 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+ }
170176 } ;
171177 providers. opt_hir_owner_nodes =
172178 |tcx, id| tcx. hir_crate ( ( ) ) . owners . get ( id) ?. as_owner ( ) . map ( |i| & i. nodes ) ;
0 commit comments