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

@@ -814,17 +814,24 @@ pub fn noop_fold_where_predicate<T: Folder>(
fld: &mut T)
-> WherePredicate {
match pred {
ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate{id,
ident,
ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate{bounded_ty,
bounds,
span}) => {
ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate {
id: fld.new_id(id),
ident: fld.fold_ident(ident),
bounded_ty: fld.fold_ty(bounded_ty),
bounds: bounds.move_map(|x| fld.fold_ty_param_bound(x)),
span: fld.new_span(span)
})
}
ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate{lifetime,
bound,
span}) => {
ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate {
span: fld.new_span(span),
lifetime: fld.fold_lifetime(lifetime),
bound: fld.fold_lifetime(bound)
})
}
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{id,
path,
ty,