summary refs log tree commit diff
path: root/src/libsyntax/parse/obsolete.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-03-19 15:39:03 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-03-24 14:55:15 -0700
commiteb2f1d925ffdb79d45c7b74cef549e54533c3951 (patch)
treea517d12dbb1458f49e21ae40e026d699576dce92 /src/libsyntax/parse/obsolete.rs
parented810385045ab0db90303574ba3ea47dfa2a36d5 (diff)
downloadrust-eb2f1d925ffdb79d45c7b74cef549e54533c3951.tar.gz
rust-eb2f1d925ffdb79d45c7b74cef549e54533c3951.zip
rustc: Add support for `extern crate foo as bar`
The compiler will now issue a warning for crates that have syntax of the form
`extern crate "foo" as bar`, but it will still continue to accept this syntax.
Additionally, the string `foo-bar` will match the crate name `foo_bar` to assist
in the transition period as well.

This patch will land hopefully in tandem with a Cargo patch that will start
translating all crate names to have underscores instead of hyphens.

cc #23533
Diffstat (limited to 'src/libsyntax/parse/obsolete.rs')
-rw-r--r--src/libsyntax/parse/obsolete.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index 7da0a6de547..276be73823a 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -24,6 +24,7 @@ use ptr::P;
 pub enum ObsoleteSyntax {
     ClosureKind,
     EmptyIndex,
+    ExternCrateString,
 }
 
 pub trait ParserObsoleteMethods {
@@ -56,6 +57,11 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
                 "write `[..]` instead",
                 false, // warning for now
             ),
+            ObsoleteSyntax::ExternCrateString => (
+                "\"crate-name\"",
+                "use an identifier not in quotes instead",
+                false, // warning for now
+            ),
         };
 
         self.report(sp, kind, kind_str, desc, error);