From 4bc09713dfea7e53095c9a64a9e4ff90868b5b2a Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Fri, 27 Dec 2013 19:14:01 -0500 Subject: [PATCH] Rename pkgid variables --- src/librustc/back/link.rs | 2 +- src/librustc/driver/driver.rs | 10 +++++----- src/librustc/front/test.rs | 2 +- src/librustc/lib.rs | 8 ++++---- src/librustc/metadata/creader.rs | 12 ++++++------ src/librustc/metadata/decoder.rs | 2 +- src/librustc/metadata/loader.rs | 4 ++-- src/librustdoc/clean.rs | 4 ++-- src/libsyntax/attr.rs | 4 ++-- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index e761a14a3ac..cf4ed099cf2 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -475,7 +475,7 @@ pub fn build_link_meta(sess: Session, truncated_hash_result(symbol_hasher).to_managed() } - let pkgid = match attr::find_pkgid(attrs) { + let crateid = match attr::find_crateid(attrs) { None => { let stem = session::expect( sess, diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 2b9acb1db9d..dba811d822f 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -1030,12 +1030,12 @@ pub fn build_output_filenames(input: &input, str_input(_) => @"rust_out" }; - // If a pkgid is present, we use it as the link name - let pkgid = attr::find_pkgid(attrs); - match pkgid { + // If a crateid is present, we use it as the link name + let crateid = attr::find_crateid(attrs); + match crateid { None => {} - Some(pkgid) => { - stem = pkgid.name.to_managed() + Some(crateid) => { + stem = crateid.name.to_managed() } } diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 47ef4b94058..476956c69f7 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -385,7 +385,7 @@ fn mk_tests(cx: &TestCtxt) -> @ast::item { } fn is_extra(crate: &ast::Crate) -> bool { - match attr::find_pkgid(crate.attrs) { + match attr::find_crateid(crate.attrs) { Some(ref s) if "extra" == s.name => true, _ => false } diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index a9f67e31089..828e65b7648 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -292,18 +292,18 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) { let t_outputs = d::build_output_filenames(&input, &odir, &ofile, attrs, sess); if crate_id || crate_name { - let pkgid = match attr::find_pkgid(attrs) { - Some(pkgid) => pkgid, + let crateid = match attr::find_crateid(attrs) { + Some(crateid) => crateid, None => { sess.fatal("No crate_id and --crate-id or \ --crate-name requested") } }; if crate_id { - println(pkgid.to_str()); + println(crateid.to_str()); } if crate_name { - println(pkgid.name); + println(crateid.name); } } diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index de5ae08cf57..2c32c343ba8 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -138,15 +138,15 @@ fn visit_view_item(e: &mut Env, i: &ast::view_item) { ident, path_opt); let (name, version) = match path_opt { Some((path_str, _)) => { - let pkgid: Option = from_str(path_str); - match pkgid { + let crateid: Option = from_str(path_str); + match crateid { None => (@"", @""), - Some(pkgid) => { - let version = match pkgid.version { + Some(crateid) => { + let version = match crateid.version { None => @"", Some(ref ver) => ver.to_managed(), }; - (pkgid.name.to_managed(), version) + (crateid.name.to_managed(), version) } } } @@ -282,7 +282,7 @@ fn resolve_crate(e: &mut Env, } = load_ctxt.load_library_crate(); let attrs = decoder::get_crate_attributes(metadata.as_slice()); - let pkgid = attr::find_pkgid(attrs).unwrap(); + let crateid = attr::find_crateid(attrs).unwrap(); let hash = decoder::get_crate_hash(metadata.as_slice()); // Claim this crate number and cache it diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index a0b339cc91d..a409887575a 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -1173,7 +1173,7 @@ pub fn get_crate_hash(data: &[u8]) -> @str { pub fn get_crate_vers(data: &[u8]) -> @str { let attrs = decoder::get_crate_attributes(data); - match attr::find_pkgid(attrs) { + match attr::find_crateid(attrs) { None => @"0.0", Some(pkgid) => pkgid.version_or_default().to_managed(), } diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index e954fc06c94..7c6be22208e 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -165,7 +165,7 @@ impl Context { } let data = lib.metadata.as_slice(); let attrs = decoder::get_crate_attributes(data); - match attr::find_pkgid(attrs) { + match attr::find_crateid(attrs) { None => {} Some(pkgid) => { note_pkgid_attr(self.sess.diagnostic(), &pkgid); @@ -241,7 +241,7 @@ fn crate_matches(crate_data: &[u8], version: @str, hash: @str) -> bool { let attrs = decoder::get_crate_attributes(crate_data); - match attr::find_pkgid(attrs) { + match attr::find_crateid(attrs) { None => false, Some(pkgid) => { if !hash.is_empty() { diff --git a/src/librustdoc/clean.rs b/src/librustdoc/clean.rs index bd5103d767c..ab36079585f 100644 --- a/src/librustdoc/clean.rs +++ b/src/librustdoc/clean.rs @@ -73,7 +73,7 @@ pub struct Crate { impl Clean for visit_ast::RustdocVisitor { fn clean(&self) -> Crate { - use syntax::attr::find_pkgid; + use syntax::attr::find_crateid; let cx = local_data::get(super::ctxtkey, |x| *x.unwrap()); let mut externs = HashMap::new(); @@ -82,7 +82,7 @@ impl Clean for visit_ast::RustdocVisitor { }); Crate { - name: match find_pkgid(self.attrs) { + name: match find_crateid(self.attrs) { Some(n) => n.name, None => fail!("rustdoc requires a `crate_id` crate attribute"), }, diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 8dff321ca0e..0bd457b254c 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -234,10 +234,10 @@ pub fn find_linkage_metas(attrs: &[Attribute]) -> ~[@MetaItem] { result } -pub fn find_pkgid(attrs: &[Attribute]) -> Option { +pub fn find_crateid(attrs: &[Attribute]) -> Option { match first_attr_value_str_by_name(attrs, "crate_id") { None => None, - Some(id) => from_str::(id), + Some(id) => from_str::(id), } }