about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 9e2829e6380..53fda92ce1b 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4825,7 +4825,8 @@ impl<'a> Parser<'a> {
     /// # Example
     ///
     /// extern crate url;
-    /// extern crate foo = "bar";
+    /// extern crate foo = "bar"; //deprecated
+    /// extern crate "bar" as foo;
     fn parse_item_extern_crate(&mut self,
                                 lo: BytePos,
                                 visibility: Visibility,
@@ -4836,6 +4837,8 @@ impl<'a> Parser<'a> {
             token::IDENT(..) => {
                 let the_ident = self.parse_ident();
                 self.expect_one_of(&[], &[token::EQ, token::SEMI]);
+                // NOTE - #16689 change this to a warning once
+                //        the 'as' support is in stage0
                 let path = if self.token == token::EQ {
                     self.bump();
                     Some(self.parse_str())
@@ -4843,7 +4846,14 @@ impl<'a> Parser<'a> {
 
                 self.expect(&token::SEMI);
                 (path, the_ident)
-            }
+            },
+            token::LIT_STR(..) | token::LIT_STR_RAW(..) => {
+                let path = self.parse_str();
+                self.expect_keyword(keywords::As);
+                let the_ident = self.parse_ident();
+                self.expect(&token::SEMI);
+                (Some(path), the_ident)
+            },
             _ => {
                 let span = self.span;
                 let token_str = self.this_token_to_string();