gce: don't ICE on non-local const

This commit is contained in:
Yotam Ofek
2025-06-27 16:59:25 +00:00
parent 13c46fd0b0
commit 0e32036deb
4 changed files with 23 additions and 16 deletions

View File

@@ -421,7 +421,9 @@ fn const_evaluatable_predicates_of<'tcx>(
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ConstCollector<'tcx> {
fn visit_const(&mut self, c: ty::Const<'tcx>) {
if let ty::ConstKind::Unevaluated(uv) = c.kind() {
if is_const_param_default(self.tcx, uv.def.expect_local()) {
if let Some(local) = uv.def.as_local()
&& is_const_param_default(self.tcx, local)
{
// Do not look into const param defaults,
// these get checked when they are actually instantiated.
//