From 0a19f4f1b4a12bd50032249be4c9298284c08e3c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 4 Mar 2019 16:38:54 +0300 Subject: allow aliases in underscores this helps with use foo::Trait as _; syntax --- crates/ra_parser/src/grammar.rs | 4 +++- crates/ra_parser/src/grammar/items/use_item.rs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'crates/ra_parser/src') diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index f94702e97..c9941fe93 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs @@ -129,7 +129,9 @@ fn opt_alias(p: &mut Parser) { if p.at(AS_KW) { let m = p.start(); p.bump(); - name(p); + if !p.eat(UNDERSCORE) { + name(p); + } m.complete(p, ALIAS); } } diff --git a/crates/ra_parser/src/grammar/items/use_item.rs b/crates/ra_parser/src/grammar/items/use_item.rs index 5111d37eb..b36612726 100644 --- a/crates/ra_parser/src/grammar/items/use_item.rs +++ b/crates/ra_parser/src/grammar/items/use_item.rs @@ -76,6 +76,7 @@ fn use_tree(p: &mut Parser) { // yet::another::path, // running::out::of::synonyms::for_::different::* // }; + // use Trait as _; opt_alias(p); } COLONCOLON => { -- cgit v1.2.3