add InlineConst check

This commit is contained in:
James Dietz 2023-06-14 18:01:05 -04:00
parent 0b475c705f
commit 20499b9669

View File

@ -95,7 +95,10 @@ pub fn const_eval_resolve_for_typeck(
// used generic parameters is a bug of evaluation, so checking for it // used generic parameters is a bug of evaluation, so checking for it
// here does feel somewhat sensible. // here does feel somewhat sensible.
if !self.features().generic_const_exprs && ct.substs.has_non_region_param() { if !self.features().generic_const_exprs && ct.substs.has_non_region_param() {
assert!(matches!(self.def_kind(ct.def), DefKind::AnonConst)); assert!(matches!(
self.def_kind(ct.def),
DefKind::InlineConst | DefKind::AnonConst
));
let mir_body = self.mir_for_ctfe(ct.def); let mir_body = self.mir_for_ctfe(ct.def);
if mir_body.is_polymorphic { if mir_body.is_polymorphic {
let Some(local_def_id) = ct.def.as_local() else { return }; let Some(local_def_id) = ct.def.as_local() else { return };