aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar/paths.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_parser/src/grammar/paths.rs')
-rw-r--r--crates/ra_parser/src/grammar/paths.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar/paths.rs b/crates/ra_parser/src/grammar/paths.rs
index 3537b0da1..07eb53b0c 100644
--- a/crates/ra_parser/src/grammar/paths.rs
+++ b/crates/ra_parser/src/grammar/paths.rs
@@ -4,6 +4,10 @@ pub(super) const PATH_FIRST: TokenSet =
4 token_set![IDENT, SELF_KW, SUPER_KW, CRATE_KW, COLONCOLON, L_ANGLE]; 4 token_set![IDENT, SELF_KW, SUPER_KW, CRATE_KW, COLONCOLON, L_ANGLE];
5 5
6pub(super) fn is_path_start(p: &Parser) -> bool { 6pub(super) fn is_path_start(p: &Parser) -> bool {
7 is_use_path_start(p) || p.at(T![<])
8}
9
10pub(super) fn is_use_path_start(p: &Parser) -> bool {
7 match p.current() { 11 match p.current() {
8 IDENT | T![self] | T![super] | T![crate] | T![::] => true, 12 IDENT | T![self] | T![super] | T![crate] | T![::] => true,
9 _ => false, 13 _ => false,
@@ -58,7 +62,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) {
58 if first && p.eat(T![<]) { 62 if first && p.eat(T![<]) {
59 types::type_(p); 63 types::type_(p);
60 if p.eat(T![as]) { 64 if p.eat(T![as]) {
61 if is_path_start(p) { 65 if is_use_path_start(p) {
62 types::path_type(p); 66 types::path_type(p);
63 } else { 67 } else {
64 p.error("expected a trait"); 68 p.error("expected a trait");