librustc: Obsolete the old external crate renaming syntax.
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]
This commit is contained in:
parent
a1f4973090
commit
1bce8698cd
3 changed files with 10 additions and 7 deletions
|
@ -42,8 +42,8 @@ extern crate flate;
|
||||||
extern crate getopts;
|
extern crate getopts;
|
||||||
extern crate graphviz;
|
extern crate graphviz;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
extern crate "rustc_llvm" as llvm;
|
extern crate rustc_llvm;
|
||||||
extern crate "rustc_back" as rustc_back;
|
extern crate rustc_back;
|
||||||
extern crate serialize;
|
extern crate serialize;
|
||||||
extern crate rbml;
|
extern crate rbml;
|
||||||
extern crate time;
|
extern crate time;
|
||||||
|
@ -53,6 +53,8 @@ extern crate time;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
|
pub use rustc_llvm as llvm;
|
||||||
|
|
||||||
mod diagnostics;
|
mod diagnostics;
|
||||||
|
|
||||||
pub mod back {
|
pub mod back {
|
||||||
|
|
|
@ -36,6 +36,7 @@ pub enum ObsoleteSyntax {
|
||||||
ObsoleteManagedExpr,
|
ObsoleteManagedExpr,
|
||||||
ObsoleteImportRenaming,
|
ObsoleteImportRenaming,
|
||||||
ObsoleteSubsliceMatch,
|
ObsoleteSubsliceMatch,
|
||||||
|
ObsoleteExternCrateRenaming,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ParserObsoleteMethods {
|
pub trait ParserObsoleteMethods {
|
||||||
|
@ -92,6 +93,10 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
|
||||||
ObsoleteSubsliceMatch => (
|
ObsoleteSubsliceMatch => (
|
||||||
"subslice match syntax",
|
"subslice match syntax",
|
||||||
"instead of `..xs`, write `xs..` in a pattern"
|
"instead of `..xs`, write `xs..` in a pattern"
|
||||||
|
),
|
||||||
|
ObsoleteExternCrateRenaming => (
|
||||||
|
"`extern crate foo = bar` syntax",
|
||||||
|
"write `extern crate bar as foo` instead"
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4783,11 +4783,7 @@ impl<'a> Parser<'a> {
|
||||||
self.bump();
|
self.bump();
|
||||||
let path = self.parse_str();
|
let path = self.parse_str();
|
||||||
let span = self.span;
|
let span = self.span;
|
||||||
self.span_warn(span,
|
self.obsolete(span, ObsoleteExternCrateRenaming);
|
||||||
format!("this extern crate syntax is deprecated. \
|
|
||||||
Use: extern crate \"{}\" as {};",
|
|
||||||
path.ref0().get(), the_ident.as_str() ).as_slice()
|
|
||||||
);
|
|
||||||
Some(path)
|
Some(path)
|
||||||
} else {None};
|
} else {None};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue