diff options
Diffstat (limited to 'crates/ra_parser/src/grammar/types.rs')
-rw-r--r-- | crates/ra_parser/src/grammar/types.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs index c0b722569..29d173305 100644 --- a/crates/ra_parser/src/grammar/types.rs +++ b/crates/ra_parser/src/grammar/types.rs | |||
@@ -29,7 +29,7 @@ fn type_with_bounds_cond(p: &mut Parser, allow_bounds: bool) { | |||
29 | T![dyn ] => dyn_trait_type(p), | 29 | T![dyn ] => dyn_trait_type(p), |
30 | // Some path types are not allowed to have bounds (no plus) | 30 | // Some path types are not allowed to have bounds (no plus) |
31 | T![<] => path_type_(p, allow_bounds), | 31 | T![<] => path_type_(p, allow_bounds), |
32 | _ if paths::is_path_start(p) => path_or_macro_type_(p, allow_bounds), | 32 | _ if paths::is_use_path_start(p) => path_or_macro_type_(p, allow_bounds), |
33 | _ => { | 33 | _ => { |
34 | p.err_recover("expected type", TYPE_RECOVERY_SET); | 34 | p.err_recover("expected type", TYPE_RECOVERY_SET); |
35 | } | 35 | } |
@@ -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 {} | ||
208 | pub(super) fn for_type(p: &mut Parser) { | 209 | pub(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(); |
@@ -251,7 +252,7 @@ pub(super) fn path_type(p: &mut Parser) { | |||
251 | // type A = foo!(); | 252 | // type A = foo!(); |
252 | // type B = crate::foo!(); | 253 | // type B = crate::foo!(); |
253 | fn path_or_macro_type_(p: &mut Parser, allow_bounds: bool) { | 254 | fn path_or_macro_type_(p: &mut Parser, allow_bounds: bool) { |
254 | assert!(paths::is_path_start(p) || p.at(T![<])); | 255 | assert!(paths::is_path_start(p)); |
255 | let m = p.start(); | 256 | let m = p.start(); |
256 | paths::type_path(p); | 257 | paths::type_path(p); |
257 | 258 | ||
@@ -270,7 +271,7 @@ fn path_or_macro_type_(p: &mut Parser, allow_bounds: bool) { | |||
270 | } | 271 | } |
271 | 272 | ||
272 | pub(super) fn path_type_(p: &mut Parser, allow_bounds: bool) { | 273 | pub(super) fn path_type_(p: &mut Parser, allow_bounds: bool) { |
273 | assert!(paths::is_path_start(p) || p.at(T![<])); | 274 | assert!(paths::is_path_start(p)); |
274 | let m = p.start(); | 275 | let m = p.start(); |
275 | paths::type_path(p); | 276 | paths::type_path(p); |
276 | 277 | ||