about summary refs log tree commit diff
path: root/src/test/parse-fail
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/test/parse-fail
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/test/parse-fail')
-rw-r--r--src/test/parse-fail/bad-lit-suffixes.rs1
-rw-r--r--src/test/parse-fail/extern-crate-as-no-string-help.rs15
-rw-r--r--src/test/parse-fail/extern-foreign-crate.rs2
3 files changed, 2 insertions, 16 deletions
diff --git a/src/test/parse-fail/bad-lit-suffixes.rs b/src/test/parse-fail/bad-lit-suffixes.rs
index d10337e768c..9e5fe4ab8a9 100644
--- a/src/test/parse-fail/bad-lit-suffixes.rs
+++ b/src/test/parse-fail/bad-lit-suffixes.rs
@@ -11,6 +11,7 @@
 
 extern crate
     "foo"suffix //~ ERROR extern crate name with a suffix is illegal
+                //~^ WARNING: obsolete syntax
      as foo;
 
 extern
diff --git a/src/test/parse-fail/extern-crate-as-no-string-help.rs b/src/test/parse-fail/extern-crate-as-no-string-help.rs
deleted file mode 100644
index 5cc52f6f6db..00000000000
--- a/src/test/parse-fail/extern-crate-as-no-string-help.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Tests that the proper help is displayed in the error message
-
-extern crate foo as bar;
-//~^ ERROR expected `;`, found `as`
-//~^^ HELP perhaps you meant to enclose the crate name `foo` in a string?
diff --git a/src/test/parse-fail/extern-foreign-crate.rs b/src/test/parse-fail/extern-foreign-crate.rs
index 24b978b0a21..1ff4368dac5 100644
--- a/src/test/parse-fail/extern-foreign-crate.rs
+++ b/src/test/parse-fail/extern-foreign-crate.rs
@@ -11,4 +11,4 @@
 // Verifies that the expected token errors for `extern crate` are
 // raised
 
-extern crate foo {} //~ERROR expected `;`, found `{`
+extern crate foo {} //~ERROR expected one of `;` or `as`, found `{`