@@ -223,20 +223,6 @@ impl<I: Interner> Relate<I> for ty::FnSig<I> {
223
223
}
224
224
}
225
225
226
- impl < I : Interner > Relate < I > for ty:: BoundConstness {
227
- fn relate < R : TypeRelation < I > > (
228
- _relation : & mut R ,
229
- a : ty:: BoundConstness ,
230
- b : ty:: BoundConstness ,
231
- ) -> RelateResult < I , ty:: BoundConstness > {
232
- if a != b {
233
- Err ( TypeError :: ConstnessMismatch ( ExpectedFound :: new ( true , a, b) ) )
234
- } else {
235
- Ok ( a)
236
- }
237
- }
238
- }
239
-
240
226
impl < I : Interner > Relate < I > for ty:: AliasTy < I > {
241
227
fn relate < R : TypeRelation < I > > (
242
228
relation : & mut R ,
@@ -664,29 +650,18 @@ impl<I: Interner, T: Relate<I>> Relate<I> for ty::Binder<I, T> {
664
650
}
665
651
}
666
652
667
- impl < I : Interner > Relate < I > for ty:: PredicatePolarity {
668
- fn relate < R : TypeRelation < I > > (
669
- _relation : & mut R ,
670
- a : ty:: PredicatePolarity ,
671
- b : ty:: PredicatePolarity ,
672
- ) -> RelateResult < I , ty:: PredicatePolarity > {
673
- if a != b {
674
- Err ( TypeError :: PolarityMismatch ( ExpectedFound :: new ( true , a, b) ) )
675
- } else {
676
- Ok ( a)
677
- }
678
- }
679
- }
680
-
681
653
impl < I : Interner > Relate < I > for ty:: TraitPredicate < I > {
682
654
fn relate < R : TypeRelation < I > > (
683
655
relation : & mut R ,
684
656
a : ty:: TraitPredicate < I > ,
685
657
b : ty:: TraitPredicate < I > ,
686
658
) -> RelateResult < I , ty:: TraitPredicate < I > > {
687
- Ok ( ty:: TraitPredicate {
688
- trait_ref : relation. relate ( a. trait_ref , b. trait_ref ) ?,
689
- polarity : relation. relate ( a. polarity , b. polarity ) ?,
690
- } )
659
+ let trait_ref = relation. relate ( a. trait_ref , b. trait_ref ) ?;
660
+ if a. polarity != b. polarity {
661
+ return Err ( TypeError :: PolarityMismatch ( ExpectedFound :: new (
662
+ true , a. polarity , b. polarity ,
663
+ ) ) ) ;
664
+ }
665
+ Ok ( ty:: TraitPredicate { trait_ref, polarity : a. polarity } )
691
666
}
692
667
}
0 commit comments