diff options
Diffstat (limited to 'crates/ra_parser/src/grammar/types.rs')
-rw-r--r-- | crates/ra_parser/src/grammar/types.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs index fe1a039cb..9e8e3bd97 100644 --- a/crates/ra_parser/src/grammar/types.rs +++ b/crates/ra_parser/src/grammar/types.rs | |||
@@ -216,19 +216,21 @@ pub(super) fn for_binder(p: &mut Parser) { | |||
216 | 216 | ||
217 | // test for_type | 217 | // test for_type |
218 | // type A = for<'a> fn() -> (); | 218 | // type A = for<'a> fn() -> (); |
219 | // fn foo<T>(_t: &T) where for<'a> &'a T: Iterator {} | 219 | // type B = for<'a> unsafe extern "C" fn(&'a ()) -> (); |
220 | // fn bar<T>(_t: &T) where for<'a> &'a mut T: Iterator {} | 220 | // type Obj = for<'a> PartialEq<&'a i32>; |
221 | // fn baz<T>(_t: &T) where for<'a> <&'a T as Baz>::Foo: Iterator {} | ||
222 | pub(super) fn for_type(p: &mut Parser) { | 221 | pub(super) fn for_type(p: &mut Parser) { |
223 | assert!(p.at(T![for])); | 222 | assert!(p.at(T![for])); |
224 | let m = p.start(); | 223 | let m = p.start(); |
225 | for_binder(p); | 224 | for_binder(p); |
226 | match p.current() { | 225 | match p.current() { |
227 | T![fn] | T![unsafe] | T![extern] => fn_pointer_type(p), | 226 | T![fn] | T![unsafe] | T![extern] => {} |
228 | T![&] => reference_type(p), | 227 | // OK: legacy trait object format |
229 | _ if paths::is_path_start(p) => path_type_(p, false), | 228 | _ if paths::is_use_path_start(p) => {} |
230 | _ => p.error("expected a path"), | 229 | _ => { |
230 | p.error("expected a function pointer or path"); | ||
231 | } | ||
231 | } | 232 | } |
233 | type_no_bounds(p); | ||
232 | m.complete(p, FOR_TYPE); | 234 | m.complete(p, FOR_TYPE); |
233 | } | 235 | } |
234 | 236 | ||