@@ -223,20 +223,6 @@ impl<I: Interner> Relate<I> for ty::FnSig<I> {
223223 }
224224}
225225
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-
240226impl < I : Interner > Relate < I > for ty:: AliasTy < I > {
241227 fn relate < R : TypeRelation < I > > (
242228 relation : & mut R ,
@@ -664,29 +650,18 @@ impl<I: Interner, T: Relate<I>> Relate<I> for ty::Binder<I, T> {
664650 }
665651}
666652
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-
681653impl < I : Interner > Relate < I > for ty:: TraitPredicate < I > {
682654 fn relate < R : TypeRelation < I > > (
683655 relation : & mut R ,
684656 a : ty:: TraitPredicate < I > ,
685657 b : ty:: TraitPredicate < I > ,
686658 ) -> 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 } )
691666 }
692667}
0 commit comments