Skip to content

Commit

Permalink
Updated to new extern crate syntax.
Browse files Browse the repository at this point in the history
Added warning for old deprecated syntax
  • Loading branch information
wickerwaka committed Sep 1, 2014
1 parent b42e079 commit 2cb210d
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/driver/driver.rs
Expand Up @@ -9,9 +9,9 @@
// except according to those terms.

#[cfg(rustdoc)]
extern crate this = "rustdoc";
extern crate "rustdoc" as this;

#[cfg(rustc)]
extern crate this = "rustc";
extern crate "rustc" as this;

fn main() { this::main() }
2 changes: 1 addition & 1 deletion src/libregex/lib.rs
Expand Up @@ -372,7 +372,7 @@
#![deny(missing_doc)]

#[cfg(test)]
extern crate stdtest = "test";
extern crate "test" as stdtest;
#[cfg(test)]
extern crate rand;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/front/std_inject.rs
Expand Up @@ -62,7 +62,7 @@ struct StandardLibraryInjector<'a> {
impl<'a> fold::Folder for StandardLibraryInjector<'a> {
fn fold_crate(&mut self, mut krate: ast::Crate) -> ast::Crate {

// The name to use in `extern crate std = "name";`
// The name to use in `extern crate "name" as std;`
let actual_crate_name = match self.sess.opts.alt_std_name {
Some(ref s) => token::intern_and_get_ident(s.as_slice()),
None => token::intern_and_get_ident("std"),
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/lib.rs
Expand Up @@ -42,8 +42,8 @@ extern crate flate;
extern crate getopts;
extern crate graphviz;
extern crate libc;
extern crate llvm = "rustc_llvm";
extern crate rustc_back = "rustc_back";
extern crate "rustc_llvm" as llvm;
extern crate "rustc_back" as rustc_back;
extern crate serialize;
extern crate rbml;
extern crate time;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/lib.rs
Expand Up @@ -23,7 +23,7 @@ extern crate libc;
extern crate rustc;
extern crate serialize;
extern crate syntax;
extern crate testing = "test";
extern crate "test" as testing;
extern crate time;
#[phase(plugin, link)] extern crate log;

Expand Down
2 changes: 1 addition & 1 deletion src/librustrt/lib.rs
Expand Up @@ -27,7 +27,7 @@ extern crate alloc;
extern crate libc;
extern crate collections;

#[cfg(test)] extern crate realrustrt = "rustrt";
#[cfg(test)] extern crate "rustrt" as realrustrt;
#[cfg(test)] extern crate test;
#[cfg(test)] extern crate native;

Expand Down
2 changes: 1 addition & 1 deletion src/librustuv/lib.rs
Expand Up @@ -52,7 +52,7 @@ via `close` and `delete` methods.

#[cfg(test)] extern crate green;
#[cfg(test)] extern crate debug;
#[cfg(test)] extern crate realrustuv = "rustuv";
#[cfg(test)] extern crate "rustuv" as realrustuv;
extern crate libc;
extern crate alloc;

Expand Down
8 changes: 4 additions & 4 deletions src/libstd/lib.rs
Expand Up @@ -129,14 +129,14 @@
extern crate alloc;
extern crate unicode;
extern crate core;
extern crate core_collections = "collections";
extern crate core_rand = "rand";
extern crate core_sync = "sync";
extern crate "collections" as core_collections;
extern crate "rand" as core_rand;
extern crate "sync" as core_sync;
extern crate libc;
extern crate rustrt;

// Make std testable by not duplicating lang items. See #2912
#[cfg(test)] extern crate realstd = "std";
#[cfg(test)] extern crate "std" as realstd;
#[cfg(test)] pub use realstd::kinds;
#[cfg(test)] pub use realstd::ops;
#[cfg(test)] pub use realstd::cmp;
Expand Down
11 changes: 8 additions & 3 deletions src/libsyntax/parse/parser.rs
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-16725.rs
Expand Up @@ -10,7 +10,7 @@

// aux-build:issue-16725.rs

extern crate foo = "issue-16725";
extern crate "issue-16725" as foo;

fn main() {
unsafe { foo::bar(); }
Expand Down
Expand Up @@ -12,7 +12,7 @@

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

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

use lib::Inv;
use lib::MaybeOwned;
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-15562.rs
Expand Up @@ -10,7 +10,7 @@

// aux-build:issue-15562.rs

extern crate i = "issue-15562";
extern crate "issue-15562" as i;

pub fn main() {
extern {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-16643.rs
Expand Up @@ -10,7 +10,7 @@

// aux-build:issue-16643.rs

extern crate i = "issue-16643";
extern crate "issue-16643" as i;

pub fn main() {
i::TreeBuilder::<uint>.process_token();
Expand Down

9 comments on commit 2cb210d

@bors
Copy link
Contributor

@bors bors commented on 2cb210d Sep 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at wickerwaka@2cb210d

@bors
Copy link
Contributor

@bors bors commented on 2cb210d Sep 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging wickerwaka/rust/crate-as-fixup = 2cb210d into auto

@bors
Copy link
Contributor

@bors bors commented on 2cb210d Sep 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wickerwaka/rust/crate-as-fixup = 2cb210d merged ok, testing candidate = c0ea860c

@bors
Copy link
Contributor

@bors bors commented on 2cb210d Sep 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at wickerwaka@2cb210d

@bors
Copy link
Contributor

@bors bors commented on 2cb210d Sep 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging wickerwaka/rust/crate-as-fixup = 2cb210d into auto

@bors
Copy link
Contributor

@bors bors commented on 2cb210d Sep 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wickerwaka/rust/crate-as-fixup = 2cb210d merged ok, testing candidate = bef51ba

@bors
Copy link
Contributor

@bors bors commented on 2cb210d Sep 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = bef51ba

Please sign in to comment.