auto merge of #16923 : wickerwaka/rust/crate-as-fixup, r=alexcrichton

Changed occurances of:
extern crate foo = "bar";
to:
extern crate "bar" as foo;

Added warning for old deprecated syntax
This commit is contained in:
bors 2014-09-04 16:40:59 +00:00
commit bef51ba234
13 changed files with 25 additions and 20 deletions

View file

@ -4773,11 +4773,16 @@ 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())
let path = self.parse_str();
let span = self.span;
self.span_warn(span,
format!("this extern crate syntax is deprecated. \
Use: extern create \"{}\" as {};",
the_ident.as_str(), path.ref0().get() ).as_slice()
);
Some(path)
} else {None};
self.expect(&token::SEMI);