diff options
author | Evgenii P <[email protected]> | 2019-08-13 16:36:01 +0100 |
---|---|---|
committer | Evgenii P <[email protected]> | 2019-08-13 16:36:01 +0100 |
commit | 8222a1fddfe73dab5e00437efeffa7d95db0b6be (patch) | |
tree | a8520fc5a354fb66b4304e0ddd210c6bfc076e92 /crates/ra_parser/src/grammar/types.rs | |
parent | f1e62501c3de7932396d29c89588ff296bbcc50d (diff) |
Fix is_path_start to accept T![<], fix is_path_start usages
Diffstat (limited to 'crates/ra_parser/src/grammar/types.rs')
-rw-r--r-- | crates/ra_parser/src/grammar/types.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs index 9acc00793..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 | } |
@@ -213,7 +213,7 @@ pub(super) fn for_type(p: &mut Parser) { | |||
213 | match p.current() { | 213 | match p.current() { |
214 | T![fn] | T![unsafe] | T![extern] => fn_pointer_type(p), | 214 | T![fn] | T![unsafe] | T![extern] => fn_pointer_type(p), |
215 | T![&] => reference_type(p), | 215 | T![&] => reference_type(p), |
216 | _ if paths::is_path_start(p) || p.at(T![<]) => path_type_(p, false), | 216 | _ if paths::is_path_start(p) => path_type_(p, false), |
217 | _ => p.error("expected a path"), | 217 | _ => p.error("expected a path"), |
218 | } | 218 | } |
219 | m.complete(p, FOR_TYPE); | 219 | m.complete(p, FOR_TYPE); |
@@ -252,7 +252,7 @@ pub(super) fn path_type(p: &mut Parser) { | |||
252 | // type A = foo!(); | 252 | // type A = foo!(); |
253 | // type B = crate::foo!(); | 253 | // type B = crate::foo!(); |
254 | fn path_or_macro_type_(p: &mut Parser, allow_bounds: bool) { | 254 | fn path_or_macro_type_(p: &mut Parser, allow_bounds: bool) { |
255 | assert!(paths::is_path_start(p) || p.at(T![<])); | 255 | assert!(paths::is_path_start(p)); |
256 | let m = p.start(); | 256 | let m = p.start(); |
257 | paths::type_path(p); | 257 | paths::type_path(p); |
258 | 258 | ||
@@ -271,7 +271,7 @@ fn path_or_macro_type_(p: &mut Parser, allow_bounds: bool) { | |||
271 | } | 271 | } |
272 | 272 | ||
273 | pub(super) fn path_type_(p: &mut Parser, allow_bounds: bool) { | 273 | pub(super) fn path_type_(p: &mut Parser, allow_bounds: bool) { |
274 | assert!(paths::is_path_start(p) || p.at(T![<])); | 274 | assert!(paths::is_path_start(p)); |
275 | let m = p.start(); | 275 | let m = p.start(); |
276 | paths::type_path(p); | 276 | paths::type_path(p); |
277 | 277 | ||