Skip to content

Commit 38b5567

Browse files
committed
Fix AST lowering for const args
1 parent 5d33dde commit 38b5567

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
@@ -1176,11 +1176,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11761176
self.arena.alloc(self.lower_anon_const_as_const_arg_direct(anon))
11771177
}
11781178

1179+
#[instrument(level = "debug", skip(self))]
11791180
fn lower_anon_const_as_const_arg_direct(&mut self, anon: &AnonConst) -> hir::ConstArg<'hir> {
11801181
if let ExprKind::Path(qself, path) = &anon.value.kind
11811182
&& let Some(res) = self
11821183
.resolver
1183-
.get_partial_res(anon.id)
1184+
.get_partial_res(anon.value.id)
11841185
.and_then(|partial_res| partial_res.full_res())
11851186
// FIXME(min_generic_const_exprs): for now we only lower params to ConstArgKind::Path
11861187
&& 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
@@ -255,7 +255,7 @@ impl<'tcx> Const<'tcx> {
255255
let hir::QPath::Resolved(_, &hir::Path { res: Res::Def(DefKind::ConstParam, def_id), .. }) =
256256
qpath
257257
else {
258-
bug!("non-param passed to Const::from_param")
258+
span_bug!(qpath.span(), "non-param {qpath:?} passed to Const::from_param")
259259
};
260260

261261
match tcx.named_bound_var(hir_id) {

0 commit comments

Comments
 (0)