auto merge of #20073 : nikomatsakis/rust/generalized-where-clause-parser, r=nikomatsakis

This is the same branch as #20002 but with the pretty-printing test fixed.
This commit is contained in:
bors 2014-12-20 16:12:37 +00:00
commit 8a33de89c4
26 changed files with 563 additions and 152 deletions

View file

@ -693,7 +693,7 @@ impl Clean<Option<Lifetime>> for ty::Region {
#[deriving(Clone, Encodable, Decodable, PartialEq)]
pub struct WherePredicate {
pub name: String,
pub ty: Type,
pub bounds: Vec<TyParamBound>
}
@ -702,11 +702,12 @@ impl Clean<WherePredicate> for ast::WherePredicate {
match *self {
ast::WherePredicate::BoundPredicate(ref wbp) => {
WherePredicate {
name: wbp.ident.clean(cx),
ty: wbp.bounded_ty.clean(cx),
bounds: wbp.bounds.clean(cx)
}
}
ast::WherePredicate::EqPredicate(_) => {
// FIXME(#20048)
_ => {
unimplemented!();
}
}

View file

@ -129,7 +129,7 @@ impl<'a> fmt::Show for WhereClause<'a> {
try!(f.write(", ".as_bytes()));
}
let bounds = pred.bounds.as_slice();
try!(write!(f, "{}: {}", pred.name, TyParamBounds(bounds)));
try!(write!(f, "{}: {}", pred.ty, TyParamBounds(bounds)));
}
Ok(())
}