about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
diff options
context:
space:
mode:
authorYotam Ofek <yotamofek@microsoft.com>2025-06-27 16:59:25 +0000
committerYotam Ofek <yotamofek@microsoft.com>2025-06-27 18:07:07 +0000
commit0e32036debd1daba5bd079a47eeaf93ec7da99b3 (patch)
tree83355e0f408abd50da9e079f4b87d130346addc4 /compiler/rustc_hir_analysis
parent13c46fd0b089360922a557d8e18a63a2c41dfbeb (diff)
downloadrust-0e32036debd1daba5bd079a47eeaf93ec7da99b3.tar.gz
rust-0e32036debd1daba5bd079a47eeaf93ec7da99b3.zip
gce: don't ICE on non-local const
Diffstat (limited to 'compiler/rustc_hir_analysis')
-rw-r--r--compiler/rustc_hir_analysis/src/collect/predicates_of.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs
index c337765c5fe..7101d36d09d 100644
--- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs
+++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs
@@ -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.
                     //