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 @@ -745,23 +745,32 @@ impl Clean<Option<Lifetime>> for ty::Region {
745
745
}
746
746
747
747
#[ deriving( Clone , RustcEncodable , RustcDecodable , PartialEq ) ]
748
- pub struct WherePredicate {
749
- pub ty : Type ,
750
- pub bounds : Vec < TyParamBound >
748
+ pub enum WherePredicate {
749
+ BoundPredicate { ty : Type , bounds : Vec < TyParamBound > } ,
750
+ RegionPredicate { lifetime : Lifetime , bounds : Vec < Lifetime > } ,
751
+ // FIXME (#20041)
752
+ EqPredicate
751
753
}
752
754
753
755
impl Clean < WherePredicate > for ast:: WherePredicate {
754
756
fn clean ( & self , cx : & DocContext ) -> WherePredicate {
755
757
match * self {
756
758
ast:: WherePredicate :: BoundPredicate ( ref wbp) => {
757
- WherePredicate {
759
+ WherePredicate :: BoundPredicate {
758
760
ty : wbp. bounded_ty . clean ( cx) ,
759
761
bounds : wbp. bounds . clean ( cx)
760
762
}
761
763
}
762
- // FIXME(#20048)
763
- _ => {
764
- unimplemented ! ( ) ;
764
+
765
+ ast:: WherePredicate :: RegionPredicate ( ref wrp) => {
766
+ WherePredicate :: RegionPredicate {
767
+ lifetime : wrp. lifetime . clean ( cx) ,
768
+ bounds : wrp. bounds . clean ( cx)
769
+ }
770
+ }
771
+
772
+ ast:: WherePredicate :: EqPredicate ( _) => {
773
+ WherePredicate :: EqPredicate
765
774
}
766
775
}
767
776
}
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