Support references in higher-ranked trait bounds

Fixes #1020
This commit is contained in:
Ville Penttinen 2019-03-24 20:51:55 +02:00
parent 18a8f48039
commit 95505e80fc
3 changed files with 130 additions and 1 deletions

View file

@ -202,12 +202,15 @@ pub(super) fn for_binder(p: &mut Parser) {
// test for_type
// type A = for<'a> fn() -> ();
// fn foo<T>(_t: &T) where for<'a> &'a T: Iterator {}
// fn bar<T>(_t: &T) where for<'a> &'a mut T: Iterator {}
pub(super) fn for_type(p: &mut Parser) {
assert!(p.at(FOR_KW));
let m = p.start();
for_binder(p);
match p.current() {
FN_KW | UNSAFE_KW | EXTERN_KW => fn_pointer_type(p),
AMP => reference_type(p),
_ if paths::is_path_start(p) => path_type_(p, false),
_ => p.error("expected a path"),
}