File tree 2 files changed +36
-9
lines changed
2 files changed +36
-9
lines changed Original file line number Diff line number Diff line change @@ -683,23 +683,32 @@ impl Clean<Option<Lifetime>> for ty::Region {
683
683
}
684
684
685
685
#[ deriving( Clone , RustcEncodable , RustcDecodable , PartialEq ) ]
686
- pub struct WherePredicate {
687
- pub ty : Type ,
688
- pub bounds : Vec < TyParamBound >
686
+ pub enum WherePredicate {
687
+ BoundPredicate { ty : Type , bounds : Vec < TyParamBound > } ,
688
+ RegionPredicate { lifetime : Lifetime , bounds : Vec < Lifetime > } ,
689
+ // FIXME (#20041)
690
+ EqPredicate
689
691
}
690
692
691
693
impl Clean < WherePredicate > for ast:: WherePredicate {
692
694
fn clean ( & self , cx : & DocContext ) -> WherePredicate {
693
695
match * self {
694
696
ast:: WherePredicate :: BoundPredicate ( ref wbp) => {
695
- WherePredicate {
697
+ WherePredicate :: BoundPredicate {
696
698
ty : wbp. bounded_ty . clean ( cx) ,
697
699
bounds : wbp. bounds . clean ( cx)
698
700
}
699
701
}
700
- // FIXME(#20048)
701
- _ => {
702
- unimplemented ! ( ) ;
702
+
703
+ ast:: WherePredicate :: RegionPredicate ( ref wrp) => {
704
+ WherePredicate :: RegionPredicate {
705
+ lifetime : wrp. lifetime . clean ( cx) ,
706
+ bounds : wrp. bounds . clean ( cx)
707
+ }
708
+ }
709
+
710
+ ast:: WherePredicate :: EqPredicate ( _) => {
711
+ WherePredicate :: EqPredicate
703
712
}
704
713
}
705
714
}
Original file line number Diff line number Diff line change @@ -128,8 +128,26 @@ impl<'a> fmt::Show for WhereClause<'a> {
128
128
if i > 0 {
129
129
try!( f. write ( ", " . as_bytes ( ) ) ) ;
130
130
}
131
- let bounds = pred. bounds . as_slice ( ) ;
132
- try!( write ! ( f, "{}: {}" , pred. ty, TyParamBounds ( bounds) ) ) ;
131
+ match pred {
132
+ & clean:: WherePredicate :: BoundPredicate { ref ty, ref bounds } => {
133
+ let bounds = bounds. as_slice ( ) ;
134
+ try!( write ! ( f, "{}: {}" , ty, TyParamBounds ( bounds) ) ) ;
135
+ } ,
136
+ & clean:: WherePredicate :: RegionPredicate { ref lifetime,
137
+ ref bounds } => {
138
+ try!( write ! ( f, "{}: " , lifetime) ) ;
139
+ for ( i, lifetime) in bounds. iter ( ) . enumerate ( ) {
140
+ if i > 0 {
141
+ try!( f. write ( " + " . as_bytes ( ) ) ) ;
142
+ }
143
+
144
+ try!( write ! ( f, "{}" , lifetime) ) ;
145
+ }
146
+ } ,
147
+ & clean:: WherePredicate :: EqPredicate => {
148
+ unimplemented ! ( )
149
+ }
150
+ }
133
151
}
134
152
Ok ( ( ) )
135
153
}
You can’t perform that action at this time.
0 commit comments