@@ -631,6 +631,15 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
631
631
b = b.eval(tcx, relation.param_env());
632
632
}
633
633
634
+ if tcx.features().generic_const_exprs {
635
+ if let Ok(Some(a2)) = tcx.expand_abstract_consts(a) {
636
+ a = a2;
637
+ }
638
+ if let Ok(Some(b2)) = tcx.expand_abstract_consts(b) {
639
+ b = b2
640
+ }
641
+ }
642
+
634
643
// Currently, the values that can be unified are primitive types,
635
644
// and those that derive both `PartialEq` and `Eq`, corresponding
636
645
// to structural-match types.
@@ -647,22 +656,6 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
647
656
(ty::ConstKind::Placeholder(p1), ty::ConstKind::Placeholder(p2)) => p1 == p2,
648
657
(ty::ConstKind::Value(a_val), ty::ConstKind::Value(b_val)) => a_val == b_val,
649
658
650
- (ty::ConstKind::Unevaluated(_), ty::ConstKind::Unevaluated(_))
651
- if tcx.features().generic_const_exprs =>
652
- {
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.
656
- if let (Ok(Some(a)), Ok(Some(b))) = (
657
- tcx.expand_abstract_consts(a),
658
- tcx.expand_abstract_consts(b),
659
- ) && a.ty() == b.ty() {
660
- return relation.consts(a, b);
661
- } else {
662
- false
663
- }
664
- }
665
-
666
659
// While this is slightly incorrect, it shouldn't matter for `min_const_generics`
667
660
// and is the better alternative to waiting until `generic_const_exprs` can
668
661
// be stabilized.
0 commit comments