diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-19 15:39:03 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-24 14:55:15 -0700 |
| commit | eb2f1d925ffdb79d45c7b74cef549e54533c3951 (patch) | |
| tree | a517d12dbb1458f49e21ae40e026d699576dce92 /src/libsyntax/std_inject.rs | |
| parent | ed810385045ab0db90303574ba3ea47dfa2a36d5 (diff) | |
| download | rust-eb2f1d925ffdb79d45c7b74cef549e54533c3951.tar.gz rust-eb2f1d925ffdb79d45c7b74cef549e54533c3951.zip | |
rustc: Add support for `extern crate foo as bar`
The compiler will now issue a warning for crates that have syntax of the form `extern crate "foo" as bar`, but it will still continue to accept this syntax. Additionally, the string `foo-bar` will match the crate name `foo_bar` to assist in the transition period as well. This patch will land hopefully in tandem with a Cargo patch that will start translating all crate names to have underscores instead of hyphens. cc #23533
Diffstat (limited to 'src/libsyntax/std_inject.rs')
| -rw-r--r-- | src/libsyntax/std_inject.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs index ac7cdb1b413..0fa7e4f902c 100644 --- a/src/libsyntax/std_inject.rs +++ b/src/libsyntax/std_inject.rs @@ -54,8 +54,8 @@ impl fold::Folder for StandardLibraryInjector { // The name to use in `extern crate "name" as std;` let actual_crate_name = match self.alt_std_name { - Some(ref s) => token::intern_and_get_ident(&s[..]), - None => token::intern_and_get_ident("std"), + Some(ref s) => token::intern(&s), + None => token::intern("std"), }; krate.module.items.insert(0, P(ast::Item { @@ -64,7 +64,7 @@ impl fold::Folder for StandardLibraryInjector { attrs: vec!( attr::mk_attr_outer(attr::mk_attr_id(), attr::mk_word_item( InternedString::new("macro_use")))), - node: ast::ItemExternCrate(Some((actual_crate_name, ast::CookedStr))), + node: ast::ItemExternCrate(Some(actual_crate_name)), vis: ast::Inherited, span: DUMMY_SP })); |
