@@ -5,6 +5,7 @@ use rustc_hir::def_id::DefId;
5
5
use rustc_macros:: { HashStable , Lift , TyDecodable , TyEncodable , TypeFoldable , TypeVisitable } ;
6
6
use rustc_type_ir:: ClauseKind as IrClauseKind ;
7
7
use rustc_type_ir:: PredicateKind as IrPredicateKind ;
8
+ use rustc_type_ir:: TraitPredicate as IrTraitPredicate ;
8
9
use rustc_type_ir:: TraitRef as IrTraitRef ;
9
10
use std:: cmp:: Ordering ;
10
11
@@ -15,6 +16,7 @@ use crate::ty::{
15
16
} ;
16
17
17
18
pub type TraitRef < ' tcx > = IrTraitRef < TyCtxt < ' tcx > > ;
19
+ pub type TraitPredicate < ' tcx > = IrTraitPredicate < TyCtxt < ' tcx > > ;
18
20
pub type ClauseKind < ' tcx > = IrClauseKind < TyCtxt < ' tcx > > ;
19
21
pub type PredicateKind < ' tcx > = IrPredicateKind < TyCtxt < ' tcx > > ;
20
22
@@ -578,37 +580,8 @@ impl<'tcx> Clause<'tcx> {
578
580
}
579
581
}
580
582
581
- #[ derive( Clone , Copy , PartialEq , Eq , Hash , TyEncodable , TyDecodable ) ]
582
- #[ derive( HashStable , TypeFoldable , TypeVisitable , Lift ) ]
583
- pub struct TraitPredicate < ' tcx > {
584
- pub trait_ref : TraitRef < ' tcx > ,
585
-
586
- /// If polarity is Positive: we are proving that the trait is implemented.
587
- ///
588
- /// If polarity is Negative: we are proving that a negative impl of this trait
589
- /// exists. (Note that coherence also checks whether negative impls of supertraits
590
- /// exist via a series of predicates.)
591
- ///
592
- /// If polarity is Reserved: that's a bug.
593
- pub polarity : PredicatePolarity ,
594
- }
595
-
596
583
pub type PolyTraitPredicate < ' tcx > = ty:: Binder < ' tcx , TraitPredicate < ' tcx > > ;
597
584
598
- impl < ' tcx > TraitPredicate < ' tcx > {
599
- pub fn with_self_ty ( self , tcx : TyCtxt < ' tcx > , self_ty : Ty < ' tcx > ) -> Self {
600
- Self { trait_ref : self . trait_ref . with_self_ty ( tcx, self_ty) , ..self }
601
- }
602
-
603
- pub fn def_id ( self ) -> DefId {
604
- self . trait_ref . def_id
605
- }
606
-
607
- pub fn self_ty ( self ) -> Ty < ' tcx > {
608
- self . trait_ref . self_ty ( )
609
- }
610
- }
611
-
612
585
impl < ' tcx > PolyTraitPredicate < ' tcx > {
613
586
pub fn def_id ( self ) -> DefId {
614
587
// Ok to skip binder since trait `DefId` does not care about regions.
0 commit comments