Fix ICE when using the min_generic_const_args incomplete feature

This commit is contained in:
Samuel Tardieu
2026-03-08 11:16:26 +01:00
parent 9450d567b9
commit 201759058d
2 changed files with 23 additions and 2 deletions
+7 -2
View File
@@ -845,8 +845,13 @@ fn fetch_path(&self, qpath: &QPath<'_>, id: HirId) -> Option<ConstValue> {
{
did
},
_ if let Res::Def(DefKind::Const { .. } | DefKind::AssocConst { .. }, did) =
self.typeck.qpath_res(qpath, id) =>
// TODO: revisit when feature `min_generic_const_args` is stabilized. In the meantime,
// `TyCtxt::const_eval_resolve()` will trigger an ICE when evaluating the body of the
// `type const` definition.
_ if let Res::Def(
DefKind::Const { is_type_const: false } | DefKind::AssocConst { is_type_const: false },
did,
) = self.typeck.qpath_res(qpath, id) =>
{
self.source.set(ConstantSource::NonLocal);
did
+16
View File
@@ -0,0 +1,16 @@
//@ check-pass
#![allow(incomplete_features)]
#![feature(min_generic_const_args)]
trait Trait {
type const N: usize;
fn process();
}
impl Trait for () {
type const N: usize = 3;
fn process() {
const N: usize = <()>::N;
_ = 0..Self::N;
}
}