Add parser support for generalized where clauses

Implement support in the parser for generalized where clauses,
as well as the conversion of ast::WherePredicates to
ty::Predicate in `collect.rs`.
This commit is contained in:
Jared Roesch
2014-12-20 02:29:19 -08:00
parent 8f51ad2420
commit e0cac488ac
25 changed files with 507 additions and 152 deletions

View File

@@ -2437,12 +2437,19 @@ impl<'a> State<'a> {
}
match predicate {
&ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate{ident,
&ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate{ref bounded_ty,
ref bounds,
..}) => {
try!(self.print_ident(ident));
try!(self.print_type(&**bounded_ty));
try!(self.print_bounds(":", bounds.as_slice()));
}
&ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate{ref lifetime,
ref bound,
..}) => {
try!(self.print_lifetime(lifetime));
try!(word(&mut self.s, ":"));
try!(self.print_lifetime(bound));
}
&ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref path, ref ty, ..}) => {
try!(self.print_path(path, false));
try!(space(&mut self.s));