From 12ac032c72aed9cc7a10d057fbdd5b5f50f2b7c8 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 11 Mar 2018 00:18:05 +0300 Subject: Implement import renaming with `_` (RFC 2166) --- src/libsyntax/parse/parser.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/libsyntax/parse/parser.rs') 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> { 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) } -- cgit 1.4.1-3-g733a5