aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar/types.rs
diff options
context:
space:
mode:
authorEvgenii P <[email protected]>2019-08-11 10:56:05 +0100
committerEvgenii P <[email protected]>2019-08-11 10:56:05 +0100
commitf1e62501c3de7932396d29c89588ff296bbcc50d (patch)
treec1039639e96fecbc20853d7b358da9bb21a57982 /crates/ra_parser/src/grammar/types.rs
parente3f8e6023d66ceb37040833bf317d77019bb10f1 (diff)
Fix for<'lifetime> for types specified by path
Diffstat (limited to 'crates/ra_parser/src/grammar/types.rs')
-rw-r--r--crates/ra_parser/src/grammar/types.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs
index c0b722569..9acc00793 100644
--- a/crates/ra_parser/src/grammar/types.rs
+++ b/crates/ra_parser/src/grammar/types.rs
@@ -205,6 +205,7 @@ pub(super) fn for_binder(p: &mut Parser) {
205// type A = for<'a> fn() -> (); 205// type A = for<'a> fn() -> ();
206// fn foo<T>(_t: &T) where for<'a> &'a T: Iterator {} 206// fn foo<T>(_t: &T) where for<'a> &'a T: Iterator {}
207// fn bar<T>(_t: &T) where for<'a> &'a mut T: Iterator {} 207// fn bar<T>(_t: &T) where for<'a> &'a mut T: Iterator {}
208// fn baz<T>(_t: &T) where for<'a> <&'a T as Baz>::Foo: Iterator {}
208pub(super) fn for_type(p: &mut Parser) { 209pub(super) fn for_type(p: &mut Parser) {
209 assert!(p.at(T![for])); 210 assert!(p.at(T![for]));
210 let m = p.start(); 211 let m = p.start();
@@ -212,7 +213,7 @@ pub(super) fn for_type(p: &mut Parser) {
212 match p.current() { 213 match p.current() {
213 T![fn] | T![unsafe] | T![extern] => fn_pointer_type(p), 214 T![fn] | T![unsafe] | T![extern] => fn_pointer_type(p),
214 T![&] => reference_type(p), 215 T![&] => reference_type(p),
215 _ if paths::is_path_start(p) => path_type_(p, false), 216 _ if paths::is_path_start(p) || p.at(T![<]) => path_type_(p, false),
216 _ => p.error("expected a path"), 217 _ => p.error("expected a path"),
217 } 218 }
218 m.complete(p, FOR_TYPE); 219 m.complete(p, FOR_TYPE);