about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-03-11 00:18:05 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-03-14 12:32:53 +0300
commit12ac032c72aed9cc7a10d057fbdd5b5f50f2b7c8 (patch)
tree4f6dbe5e034b39893c39b1dbb233f1181312695c /src/libsyntax/parse
parentfab632f9759af4f3d96c6ec69e24e5428060dba4 (diff)
downloadrust-12ac032c72aed9cc7a10d057fbdd5b5f50f2b7c8.tar.gz
rust-12ac032c72aed9cc7a10d057fbdd5b5f50f2b7c8.zip
Implement import renaming with `_` (RFC 2166)
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index bd0ca0e6704..2506a7f72d2 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -7040,7 +7040,11 @@ impl<'a> Parser<'a> {
 
     fn parse_rename(&mut self) -> PResult<'a, Option<Ident>> {
         if self.eat_keyword(keywords::As) {
-            self.parse_ident().map(Some)
+            if self.eat(&token::Underscore) {
+                Ok(Some(Ident::with_empty_ctxt(Symbol::gensym("_"))))
+            } else {
+                self.parse_ident().map(Some)
+            }
         } else {
             Ok(None)
         }