Skip to content

Commit 430f7d1

Browse files
BoxyUwUJulianKnodt
authored andcommitted
add FIXME's
1 parent 95e1a39 commit 430f7d1

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

compiler/rustc_const_eval/src/interpret/operand.rs

+1
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
561561
ty::ConstKind::Param(_) | ty::ConstKind::Placeholder(..) => {
562562
throw_inval!(TooGeneric)
563563
}
564+
// FIXME(generic_const_exprs): `ConstKind::Expr` should be able to be evaluated
564565
ty::ConstKind::Expr(_) => throw_inval!(TooGeneric),
565566
ty::ConstKind::Error(reported) => {
566567
throw_inval!(AlreadyReported(reported))

compiler/rustc_middle/src/ty/relate.rs

+3
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,9 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
650650
(ty::ConstKind::Unevaluated(_), ty::ConstKind::Unevaluated(_))
651651
if tcx.features().generic_const_exprs =>
652652
{
653+
// FIXME(generic_const_exprs): this spurriously fails when relating two assoc consts
654+
// i.e. `<T as Trait>::ASSOC eq <T as Trait>::ASSOC` would return `false`. Wheras if
655+
// both were behind an anon const that gets normalized away here it would succeed.
653656
if let (Ok(Some(a)), Ok(Some(b))) = (
654657
tcx.expand_abstract_consts(a),
655658
tcx.expand_abstract_consts(b),

compiler/rustc_trait_selection/src/traits/const_evaluatable.rs

+7
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ fn satisfied_from_param_env<'tcx>(
149149
} else if let ty::ConstKind::Expr(e) = c.kind() {
150150
e.visit_with(self)
151151
} else {
152+
// FIXME(generic_const_exprs): This doesn't recurse into `<T as Trait<U>>::ASSOC`'s substs.
153+
// This is currently unobservable as `<T as Trait<{ U + 1 }>>::ASSOC` creates an anon const
154+
// with its own `ConstEvaluatable` bound in the param env which we will visit separately.
155+
//
156+
// If we start allowing directly writing `ConstKind::Expr` without an intermediate anon const
157+
// this will be incorrect. It might be worth investigating making `predicates_of` elaborate
158+
// all of the `ConstEvaluatable` bounds rather than having a visitor here.
152159
ControlFlow::CONTINUE
153160
}
154161
}

0 commit comments

Comments
 (0)