about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_const_eval/src/interpret/operand.rs1
-rw-r--r--compiler/rustc_middle/src/ty/relate.rs3
-rw-r--r--compiler/rustc_trait_selection/src/traits/const_evaluatable.rs7
3 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs
index 6619a40b085..221e359d24a 100644
--- a/compiler/rustc_const_eval/src/interpret/operand.rs
+++ b/compiler/rustc_const_eval/src/interpret/operand.rs
@@ -561,6 +561,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
             ty::ConstKind::Param(_) | ty::ConstKind::Placeholder(..) => {
                 throw_inval!(TooGeneric)
             }
+            // FIXME(generic_const_exprs): `ConstKind::Expr` should be able to be evaluated
             ty::ConstKind::Expr(_) => throw_inval!(TooGeneric),
             ty::ConstKind::Error(reported) => {
                 throw_inval!(AlreadyReported(reported))
diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs
index decd99de3c4..8b460bfe044 100644
--- a/compiler/rustc_middle/src/ty/relate.rs
+++ b/compiler/rustc_middle/src/ty/relate.rs
@@ -650,6 +650,9 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
         (ty::ConstKind::Unevaluated(_), ty::ConstKind::Unevaluated(_))
             if tcx.features().generic_const_exprs =>
         {
+            // FIXME(generic_const_exprs): this spurriously fails when relating two assoc consts
+            // i.e. `<T as Trait>::ASSOC eq <T as Trait>::ASSOC` would return `false`. Wheras if
+            // both were behind an anon const that gets normalized away here it would succeed.
             if let (Ok(Some(a)), Ok(Some(b))) = (
                 tcx.expand_abstract_consts(a),
                 tcx.expand_abstract_consts(b),
diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
index 42d50b68c6d..b72bc42fa65 100644
--- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
+++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
@@ -149,6 +149,13 @@ fn satisfied_from_param_env<'tcx>(
             } else if let ty::ConstKind::Expr(e) = c.kind() {
                 e.visit_with(self)
             } else {
+                // FIXME(generic_const_exprs): This doesn't recurse into `<T as Trait<U>>::ASSOC`'s substs.
+                // This is currently unobservable as `<T as Trait<{ U + 1 }>>::ASSOC` creates an anon const
+                // with its own `ConstEvaluatable` bound in the param env which we will visit separately.
+                //
+                // If we start allowing directly writing `ConstKind::Expr` without an intermediate anon const
+                // this will be incorrect. It might be worth investigating making `predicates_of` elaborate
+                // all of the `ConstEvaluatable` bounds rather than having a visitor here.
                 ControlFlow::CONTINUE
             }
         }