Skip to content

Commit e0dd606

Browse files
committed
Fix AST lowering for const args
1 parent 65188d5 commit e0dd606

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,11 +1181,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11811181
self.arena.alloc(self.lower_anon_const_as_const_arg_direct(anon))
11821182
}
11831183

1184+
#[instrument(level = "debug", skip(self))]
11841185
fn lower_anon_const_as_const_arg_direct(&mut self, anon: &AnonConst) -> hir::ConstArg<'hir> {
11851186
if let ExprKind::Path(qself, path) = &anon.value.kind
11861187
&& let Some(res) = self
11871188
.resolver
1188-
.get_partial_res(anon.id)
1189+
.get_partial_res(anon.value.id)
11891190
.and_then(|partial_res| partial_res.full_res())
11901191
// FIXME(min_generic_const_exprs): for now we only lower params to ConstArgKind::Path
11911192
&& let Res::Def(DefKind::ConstParam, _) = res

compiler/rustc_middle/src/ty/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ impl<'tcx> Const<'tcx> {
293293
let hir::QPath::Resolved(_, &hir::Path { res: Res::Def(DefKind::ConstParam, def_id), .. }) =
294294
qpath
295295
else {
296-
bug!("non-param passed to Const::from_param")
296+
span_bug!(qpath.span(), "non-param {qpath:?} passed to Const::from_param")
297297
};
298298

299299
// Use the type from the param's definition, since we can resolve it,

0 commit comments

Comments
 (0)