@@ -629,6 +629,8 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
629
629
b = tcx. expand_abstract_consts ( b) ;
630
630
}
631
631
632
+ debug ! ( "{}.super_relate_consts(normed_a = {:?}, normed_b = {:?})" , relation. tag( ) , a, b) ;
633
+
632
634
// Currently, the values that can be unified are primitive types,
633
635
// and those that derive both `PartialEq` and `Eq`, corresponding
634
636
// to structural-match types.
@@ -665,30 +667,28 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
665
667
666
668
// FIXME(generic_const_exprs): is it possible to relate two consts which are not identical
667
669
// exprs? Should we care about that?
670
+ // FIXME(generic_const_exprs): relating the `ty()`s is a little weird since it is supposed to
671
+ // ICE If they mismatch. Unfortunately `ConstKind::Expr` is a little special and can be thought
672
+ // of as being generic over the argument types, however this is implicit so these types don't get
673
+ // related when we relate the substs of the item this const arg is for.
668
674
let expr = match ( ae, be) {
669
- ( Expr :: Binop ( a_op, al, ar) , Expr :: Binop ( b_op, bl, br) )
670
- if a_op == b_op && al. ty ( ) == bl. ty ( ) && ar . ty ( ) == br . ty ( ) =>
671
- {
675
+ ( Expr :: Binop ( a_op, al, ar) , Expr :: Binop ( b_op, bl, br) ) if a_op == b_op => {
676
+ r . relate ( al. ty ( ) , bl. ty ( ) ) ? ;
677
+ r . relate ( ar . ty ( ) , br . ty ( ) ) ? ;
672
678
Expr :: Binop ( a_op, r. consts ( al, bl) ?, r. consts ( ar, br) ?)
673
679
}
674
- ( Expr :: UnOp ( a_op, av) , Expr :: UnOp ( b_op, bv) )
675
- if a_op == b_op && av. ty ( ) == bv. ty ( ) =>
676
- {
680
+ ( Expr :: UnOp ( a_op, av) , Expr :: UnOp ( b_op, bv) ) if a_op == b_op => {
681
+ r. relate ( av. ty ( ) , bv. ty ( ) ) ?;
677
682
Expr :: UnOp ( a_op, r. consts ( av, bv) ?)
678
683
}
679
- ( Expr :: Cast ( ak, av, at) , Expr :: Cast ( bk, bv, bt) )
680
- if ak == bk && av. ty ( ) == bv. ty ( ) =>
681
- {
684
+ ( Expr :: Cast ( ak, av, at) , Expr :: Cast ( bk, bv, bt) ) if ak == bk => {
685
+ r. relate ( av. ty ( ) , bv. ty ( ) ) ?;
682
686
Expr :: Cast ( ak, r. consts ( av, bv) ?, r. tys ( at, bt) ?)
683
687
}
684
688
( Expr :: FunctionCall ( af, aa) , Expr :: FunctionCall ( bf, ba) )
685
- if aa. len ( ) == ba. len ( )
686
- && af. ty ( ) == bf. ty ( )
687
- && aa
688
- . iter ( )
689
- . zip ( ba. iter ( ) )
690
- . all ( |( a_arg, b_arg) | a_arg. ty ( ) == b_arg. ty ( ) ) =>
689
+ if aa. len ( ) == ba. len ( ) =>
691
690
{
691
+ r. relate ( af. ty ( ) , bf. ty ( ) ) ?;
692
692
let func = r. consts ( af, bf) ?;
693
693
let mut related_args = Vec :: with_capacity ( aa. len ( ) ) ;
694
694
for ( a_arg, b_arg) in aa. iter ( ) . zip ( ba. iter ( ) ) {
0 commit comments