mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Fix ICE when using the min_generic_const_args incomplete feature
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user