diff options
| author | bors <bors@rust-lang.org> | 2014-07-05 22:51:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-07-05 22:51:38 +0000 |
| commit | c3ef04be5589901e7f3d9428ebe8f1eb2bdca7e4 (patch) | |
| tree | 38550cd6dbb5daa27969c3f05b3e46c01ba4f2d0 /src/libsyntax/ext | |
| parent | b8ef5cf1310a7b1e31d0993885d867a6804597ad (diff) | |
| parent | 56f71015515490b65b5fbb46ff0bbc7d7af82450 (diff) | |
| download | rust-c3ef04be5589901e7f3d9428ebe8f1eb2bdca7e4.tar.gz rust-c3ef04be5589901e7f3d9428ebe8f1eb2bdca7e4.zip | |
auto merge of #15319 : alexcrichton/rust/no-crate-id, r=brson
This is an implementation of [RFC 35](https://github.com/rust-lang/rfcs/blob/master/active/0035-remove-crate-id.md). The summary for this PR is the same as that of the RFC, with one addendum: * Removes the `#[crate_id]` attribute and knowledge of versions from rustc. * Added a `#[crate_name]` attribute similar to the old `#[crate_id]` attribute * Output filenames no longer have versions or hashes * Symbols no longer have versions (they still have hashes) * A new flag, `--extern`, is used to override searching for external crates * A new flag, `-C metadata=foo`, used when hashing symbols * [added] An old flag, `--crate-name`, was re purposed to specify the crate name from the command line. I tried to maintain backwards compatibility wherever possible (with warnings being printed). If I missed anywhere, however, please let me know! [breaking-change] Closes #14468 Closes #14469 Closes #14470 Closes #14471
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 11 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index cf69277594f..673ae31ef77 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -452,7 +452,7 @@ impl<'a> ExtCtxt<'a> { pub fn mod_pop(&mut self) { self.mod_path.pop().unwrap(); } pub fn mod_path(&self) -> Vec<ast::Ident> { let mut v = Vec::new(); - v.push(token::str_to_ident(self.ecfg.crate_id.name.as_slice())); + v.push(token::str_to_ident(self.ecfg.crate_name.as_slice())); v.extend(self.mod_path.iter().map(|a| *a)); return v; } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index b30b62c8901..752b3a09e65 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -19,7 +19,6 @@ use attr; use attr::AttrMetaMethods; use codemap; use codemap::{Span, Spanned, ExpnInfo, NameAndSpan, MacroBang, MacroAttribute}; -use crateid::CrateId; use ext::base::*; use fold; use fold::*; @@ -985,7 +984,7 @@ fn new_span(cx: &ExtCtxt, sp: Span) -> Span { pub struct ExpansionConfig { pub deriving_hash_type_parameter: bool, - pub crate_id: CrateId, + pub crate_name: String, } pub struct ExportedMacros { @@ -1184,7 +1183,7 @@ mod test { // should fail: let cfg = ::syntax::ext::expand::ExpansionConfig { deriving_hash_type_parameter: false, - crate_id: from_str("test").unwrap(), + crate_name: "test".to_str(), }; expand_crate(&sess,cfg,vec!(),vec!(),crate_ast); } @@ -1201,7 +1200,7 @@ mod test { Vec::new(), &sess); let cfg = ::syntax::ext::expand::ExpansionConfig { deriving_hash_type_parameter: false, - crate_id: from_str("test").unwrap(), + crate_name: "test".to_str(), }; expand_crate(&sess,cfg,vec!(),vec!(),crate_ast); } @@ -1217,7 +1216,7 @@ mod test { Vec::new(), &sess); let cfg = ::syntax::ext::expand::ExpansionConfig { deriving_hash_type_parameter: false, - crate_id: from_str("test").unwrap(), + crate_name: "test".to_str(), }; expand_crate(&sess, cfg, vec!(), vec!(), crate_ast); } @@ -1254,7 +1253,7 @@ mod test { // the cfg argument actually does matter, here... let cfg = ::syntax::ext::expand::ExpansionConfig { deriving_hash_type_parameter: false, - crate_id: from_str("test").unwrap(), + crate_name: "test".to_str(), }; expand_crate(&ps,cfg,vec!(),vec!(),crate_ast) } |
