Skip to content

Commit 036f380

Browse files
committed
auto merge of #17048 : pcwalton/rust/remove-old-import-renaming-syntax, r=brson
Instead of `extern crate foo = bar`, write `extern crate bar as foo`. Instead of `extern crate baz = "quux"`, write `extern crate "quux" as baz`. Closes #16461. [breaking-change] r? @brson
2 parents 6ceb9b4 + 1bce869 commit 036f380

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/librustc/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ extern crate flate;
4242
extern crate getopts;
4343
extern crate graphviz;
4444
extern crate libc;
45-
extern crate "rustc_llvm" as llvm;
46-
extern crate "rustc_back" as rustc_back;
45+
extern crate rustc_llvm;
46+
extern crate rustc_back;
4747
extern crate serialize;
4848
extern crate rbml;
4949
extern crate time;
@@ -53,6 +53,8 @@ extern crate time;
5353
#[cfg(test)]
5454
extern crate test;
5555

56+
pub use rustc_llvm as llvm;
57+
5658
mod diagnostics;
5759

5860
pub mod back {

src/libsyntax/parse/obsolete.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub enum ObsoleteSyntax {
3636
ObsoleteManagedExpr,
3737
ObsoleteImportRenaming,
3838
ObsoleteSubsliceMatch,
39+
ObsoleteExternCrateRenaming,
3940
}
4041

4142
pub trait ParserObsoleteMethods {
@@ -92,6 +93,10 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
9293
ObsoleteSubsliceMatch => (
9394
"subslice match syntax",
9495
"instead of `..xs`, write `xs..` in a pattern"
96+
),
97+
ObsoleteExternCrateRenaming => (
98+
"`extern crate foo = bar` syntax",
99+
"write `extern crate bar as foo` instead"
95100
)
96101
};
97102

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4783,11 +4783,7 @@ impl<'a> Parser<'a> {
47834783
self.bump();
47844784
let path = self.parse_str();
47854785
let span = self.span;
4786-
self.span_warn(span,
4787-
format!("this extern crate syntax is deprecated. \
4788-
Use: extern crate \"{}\" as {};",
4789-
path.ref0().get(), the_ident.as_str() ).as_slice()
4790-
);
4786+
self.obsolete(span, ObsoleteExternCrateRenaming);
47914787
Some(path)
47924788
} else {None};
47934789

0 commit comments

Comments
 (0)