diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index e28e125caa4d431ec9488cf026bc12e618c52a37..2e0affe827b7f993a845b5ff12abb2a902c0cb65 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -745,23 +745,32 @@ fn clean(&self, cx: &DocContext) -> Option { } #[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)] -pub struct WherePredicate { - pub ty: Type, - pub bounds: Vec +pub enum WherePredicate { + BoundPredicate { ty: Type, bounds: Vec }, + RegionPredicate { lifetime: Lifetime, bounds: Vec}, + // FIXME (#20041) + EqPredicate } impl Clean for ast::WherePredicate { fn clean(&self, cx: &DocContext) -> WherePredicate { match *self { ast::WherePredicate::BoundPredicate(ref wbp) => { - WherePredicate { + WherePredicate::BoundPredicate { ty: wbp.bounded_ty.clean(cx), bounds: wbp.bounds.clean(cx) } } - // FIXME(#20048) - _ => { - unimplemented!(); + + ast::WherePredicate::RegionPredicate(ref wrp) => { + WherePredicate::RegionPredicate { + lifetime: wrp.lifetime.clean(cx), + bounds: wrp.bounds.clean(cx) + } + } + + ast::WherePredicate::EqPredicate(_) => { + WherePredicate::EqPredicate } } } diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 841588e401261d7d01fa73a1e0cfd2eaf885e1ed..25c4f4e01b620d0ea61a28554bb7c35ea60a438a 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -128,8 +128,26 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if i > 0 { try!(f.write(", ".as_bytes())); } - let bounds = pred.bounds.as_slice(); - try!(write!(f, "{}: {}", pred.ty, TyParamBounds(bounds))); + match pred { + &clean::WherePredicate::BoundPredicate { ref ty, ref bounds } => { + let bounds = bounds.as_slice(); + try!(write!(f, "{}: {}", ty, TyParamBounds(bounds))); + } + &clean::WherePredicate::RegionPredicate { ref lifetime, + ref bounds } => { + try!(write!(f, "{}: ", lifetime)); + for (i, lifetime) in bounds.iter().enumerate() { + if i > 0 { + try!(f.write(" + ".as_bytes())); + } + + try!(write!(f, "{}", lifetime)); + } + } + &clean::WherePredicate::EqPredicate => { + unimplemented!() + } + } } Ok(()) }