@@ -572,7 +572,7 @@ impl<I: Interner> MayInvalidate<'_, I> {
572
572
}
573
573
574
574
( TyData :: Placeholder ( p1) , TyData :: Placeholder ( p2) ) => {
575
- self . aggregate_placeholder_tys ( p1, p2)
575
+ self . aggregate_placeholders ( p1, p2)
576
576
}
577
577
578
578
( TyData :: Alias ( alias1) , TyData :: Alias ( alias2) ) => {
@@ -592,8 +592,36 @@ impl<I: Interner> MayInvalidate<'_, I> {
592
592
true
593
593
}
594
594
595
- fn aggregate_consts ( & mut self , _: & Const < I > , _: & Const < I > ) -> bool {
596
- true
595
+ // Returns true if the two consts could be unequal.
596
+ fn aggregate_consts ( & mut self , new : & Const < I > , current : & Const < I > ) -> bool {
597
+ let interner = self . interner ;
598
+ match ( new. data ( interner) , current. data ( interner) ) {
599
+ ( _, ConstData :: BoundVar ( _) ) => {
600
+ // see comment in aggregate_tys
601
+ false
602
+ }
603
+
604
+ ( ConstData :: BoundVar ( _) , _) => {
605
+ // see comment in aggregate_tys
606
+ true
607
+ }
608
+
609
+ ( ConstData :: InferenceVar ( _) , _) | ( _, ConstData :: InferenceVar ( _) ) => {
610
+ panic ! (
611
+ "unexpected free inference variable in may-invalidate: {:?} vs {:?}" ,
612
+ new, current,
613
+ ) ;
614
+ }
615
+
616
+ ( ConstData :: Placeholder ( p1) , ConstData :: Placeholder ( p2) ) => {
617
+ self . aggregate_placeholders ( p1, p2)
618
+ }
619
+
620
+ ( ConstData :: Concrete ( c1) , ConstData :: Concrete ( c2) ) => !c1. c_eq ( c2, interner) ,
621
+
622
+ // Only variants left are placeholder = concrete, which always fails
623
+ ( ConstData :: Placeholder ( _) , _) | ( ConstData :: Concrete ( _) , _) => true ,
624
+ }
597
625
}
598
626
599
627
fn aggregate_application_tys (
@@ -618,7 +646,7 @@ impl<I: Interner> MayInvalidate<'_, I> {
618
646
)
619
647
}
620
648
621
- fn aggregate_placeholder_tys (
649
+ fn aggregate_placeholders (
622
650
& mut self ,
623
651
new : & PlaceholderIndex ,
624
652
current : & PlaceholderIndex ,
0 commit comments