Skip to content

Commit ea70d2a

Browse files
committed
Add some logging
1 parent 693ccea commit ea70d2a

File tree

2 files changed

+17
-8
lines changed
  • compiler

2 files changed

+17
-8
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11611161
}
11621162
}
11631163

1164+
#[instrument(level = "debug", skip(self))]
11641165
fn lower_const_path_as_const_arg(
11651166
&mut self,
11661167
path: &Path,
@@ -1231,11 +1232,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12311232

12321233
#[instrument(level = "debug", skip(self))]
12331234
fn lower_anon_const_as_const_arg_direct(&mut self, anon: &AnonConst) -> hir::ConstArg<'hir> {
1235+
let maybe_res = self
1236+
.resolver
1237+
.get_partial_res(anon.value.id)
1238+
.and_then(|partial_res| partial_res.full_res());
1239+
debug!("res={:?}", maybe_res);
12341240
if let ExprKind::Path(qself, path) = &anon.value.kind
1235-
&& let Some(res) = self
1236-
.resolver
1237-
.get_partial_res(anon.value.id)
1238-
.and_then(|partial_res| partial_res.full_res())
1241+
&& let Some(res) = maybe_res
12391242
// FIXME(min_generic_const_exprs): for now we only lower params to ConstArgKind::Path
12401243
&& let Res::Def(DefKind::ConstParam, _) = res
12411244
{

compiler/rustc_middle/src/hir/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId};
1717
use rustc_hir::*;
1818
use rustc_macros::{Decodable, Encodable, HashStable};
1919
use 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

Comments
 (0)