Skip to content

Commit bef51ba

Browse files
committed
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
2 parents 4a5a9c5 + 2cb210d commit bef51ba

File tree

13 files changed

+25
-20
lines changed

13 files changed

+25
-20
lines changed

src/driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
// except according to those terms.
1010

1111
#[cfg(rustdoc)]
12-
extern crate this = "rustdoc";
12+
extern crate "rustdoc" as this;
1313

1414
#[cfg(rustc)]
15-
extern crate this = "rustc";
15+
extern crate "rustc" as this;
1616

1717
fn main() { this::main() }

src/libregex/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@
372372
#![deny(missing_doc)]
373373

374374
#[cfg(test)]
375-
extern crate stdtest = "test";
375+
extern crate "test" as stdtest;
376376
#[cfg(test)]
377377
extern crate rand;
378378

src/librustc/front/std_inject.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct StandardLibraryInjector<'a> {
6262
impl<'a> fold::Folder for StandardLibraryInjector<'a> {
6363
fn fold_crate(&mut self, mut krate: ast::Crate) -> ast::Crate {
6464

65-
// The name to use in `extern crate std = "name";`
65+
// The name to use in `extern crate "name" as std;`
6666
let actual_crate_name = match self.sess.opts.alt_std_name {
6767
Some(ref s) => token::intern_and_get_ident(s.as_slice()),
6868
None => token::intern_and_get_ident("std"),

src/librustc/lib.rs

Lines changed: 2 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 llvm = "rustc_llvm";
46-
extern crate rustc_back = "rustc_back";
45+
extern crate "rustc_llvm" as llvm;
46+
extern crate "rustc_back" as rustc_back;
4747
extern crate serialize;
4848
extern crate rbml;
4949
extern crate time;

src/librustdoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern crate libc;
2323
extern crate rustc;
2424
extern crate serialize;
2525
extern crate syntax;
26-
extern crate testing = "test";
26+
extern crate "test" as testing;
2727
extern crate time;
2828
#[phase(plugin, link)] extern crate log;
2929

src/librustrt/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern crate alloc;
2727
extern crate libc;
2828
extern crate collections;
2929

30-
#[cfg(test)] extern crate realrustrt = "rustrt";
30+
#[cfg(test)] extern crate "rustrt" as realrustrt;
3131
#[cfg(test)] extern crate test;
3232
#[cfg(test)] extern crate native;
3333

src/librustuv/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ via `close` and `delete` methods.
5252

5353
#[cfg(test)] extern crate green;
5454
#[cfg(test)] extern crate debug;
55-
#[cfg(test)] extern crate realrustuv = "rustuv";
55+
#[cfg(test)] extern crate "rustuv" as realrustuv;
5656
extern crate libc;
5757
extern crate alloc;
5858

src/libstd/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@
129129
extern crate alloc;
130130
extern crate unicode;
131131
extern crate core;
132-
extern crate core_collections = "collections";
133-
extern crate core_rand = "rand";
134-
extern crate core_sync = "sync";
132+
extern crate "collections" as core_collections;
133+
extern crate "rand" as core_rand;
134+
extern crate "sync" as core_sync;
135135
extern crate libc;
136136
extern crate rustrt;
137137

138138
// Make std testable by not duplicating lang items. See #2912
139-
#[cfg(test)] extern crate realstd = "std";
139+
#[cfg(test)] extern crate "std" as realstd;
140140
#[cfg(test)] pub use realstd::kinds;
141141
#[cfg(test)] pub use realstd::ops;
142142
#[cfg(test)] pub use realstd::cmp;

src/libsyntax/parse/parser.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4773,11 +4773,16 @@ impl<'a> Parser<'a> {
47734773
token::IDENT(..) => {
47744774
let the_ident = self.parse_ident();
47754775
self.expect_one_of(&[], &[token::EQ, token::SEMI]);
4776-
// NOTE - #16689 change this to a warning once
4777-
// the 'as' support is in stage0
47784776
let path = if self.token == token::EQ {
47794777
self.bump();
4780-
Some(self.parse_str())
4778+
let path = self.parse_str();
4779+
let span = self.span;
4780+
self.span_warn(span,
4781+
format!("this extern crate syntax is deprecated. \
4782+
Use: extern create \"{}\" as {};",
4783+
the_ident.as_str(), path.ref0().get() ).as_slice()
4784+
);
4785+
Some(path)
47814786
} else {None};
47824787

47834788
self.expect(&token::SEMI);

src/test/compile-fail/issue-16725.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// aux-build:issue-16725.rs
1212

13-
extern crate foo = "issue-16725";
13+
extern crate "issue-16725" as foo;
1414

1515
fn main() {
1616
unsafe { foo::bar(); }

src/test/compile-fail/regions-bounded-method-type-parameters-cross-crate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// Check explicit region bounds on methods in the cross crate case.
1414

15-
extern crate lib = "regions-bounded-method-type-parameters-cross-crate-lib";
15+
extern crate "regions-bounded-method-type-parameters-cross-crate-lib" as lib;
1616

1717
use lib::Inv;
1818
use lib::MaybeOwned;

src/test/run-pass/issue-15562.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// aux-build:issue-15562.rs
1212

13-
extern crate i = "issue-15562";
13+
extern crate "issue-15562" as i;
1414

1515
pub fn main() {
1616
extern {

src/test/run-pass/issue-16643.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// aux-build:issue-16643.rs
1212

13-
extern crate i = "issue-16643";
13+
extern crate "issue-16643" as i;
1414

1515
pub fn main() {
1616
i::TreeBuilder::<uint>.process_token();

0 commit comments

Comments
 (0)