about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLuis de Bethencourt <luis@debethencourt.com>2013-12-28 12:16:48 -0500
committerLuis de Bethencourt <luis@debethencourt.com>2013-12-29 15:25:32 -0500
commitf872c472788ca00a88d56ec5d6b3ff73a8dcc005 (patch)
treef123e7cd655e31c8c3ea271e3530cde42cb59d04 /src
parent4bc09713dfea7e53095c9a64a9e4ff90868b5b2a (diff)
downloadrust-f872c472788ca00a88d56ec5d6b3ff73a8dcc005.tar.gz
rust-f872c472788ca00a88d56ec5d6b3ff73a8dcc005.zip
Rename PkgId to CrateId
Diffstat (limited to 'src')
-rw-r--r--src/librustc/back/link.rs22
-rw-r--r--src/librustc/metadata/common.rs4
-rw-r--r--src/librustc/metadata/creader.rs20
-rw-r--r--src/librustc/metadata/decoder.rs2
-rw-r--r--src/librustc/metadata/encoder.rs10
-rw-r--r--src/librustc/metadata/loader.rs22
-rw-r--r--src/librustc/middle/trans/base.rs10
-rw-r--r--src/librustc/middle/trans/debuginfo.rs2
-rw-r--r--src/librustc/middle/trans/expr.rs2
-rw-r--r--src/libsyntax/attr.rs2
-rw-r--r--src/libsyntax/crateid.rs (renamed from src/libsyntax/pkgid.rs)102
-rw-r--r--src/libsyntax/lib.rs2
12 files changed, 100 insertions, 100 deletions
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index cf4ed099cf2..786c05de204 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -41,7 +41,7 @@ use syntax::ast;
 use syntax::ast_map::{path, path_mod, path_name, path_pretty_name};
 use syntax::attr;
 use syntax::attr::AttrMetaMethods;
-use syntax::pkgid::PkgId;
+use syntax::crateid::CrateId;
 
 #[deriving(Clone, Eq)]
 pub enum output_type {
@@ -444,13 +444,13 @@ pub mod write {
  *
  * So here is what we do:
  *
- *  - Consider the package id; every crate has one (specified with pkgid
+ *  - Consider the package id; every crate has one (specified with crate_id
  *    attribute).  If a package id isn't provided explicitly, we infer a
  *    versionless one from the output name. The version will end up being 0.0
  *    in this case. CNAME and CVERS are taken from this package id. For
  *    example, github.com/mozilla/CNAME#CVERS.
  *
- *  - Define CMH as SHA256(pkgid).
+ *  - Define CMH as SHA256(crateid).
  *
  *  - Define CMH8 as the first 8 characters of CMH.
  *
@@ -469,9 +469,9 @@ pub fn build_link_meta(sess: Session,
                        symbol_hasher: &mut Sha256)
                        -> LinkMeta {
     // This calculates CMH as defined above
-    fn crate_hash(symbol_hasher: &mut Sha256, pkgid: &PkgId) -> @str {
+    fn crate_hash(symbol_hasher: &mut Sha256, crateid: &CrateId) -> @str {
         symbol_hasher.reset();
-        symbol_hasher.input_str(pkgid.to_str());
+        symbol_hasher.input_str(crateid.to_str());
         truncated_hash_result(symbol_hasher).to_managed()
     }
 
@@ -487,10 +487,10 @@ pub fn build_link_meta(sess: Session,
         Some(s) => s,
     };
 
-    let hash = crate_hash(symbol_hasher, &pkgid);
+    let hash = crate_hash(symbol_hasher, &crateid);
 
     LinkMeta {
-        pkgid: pkgid,
+        crateid: crateid,
         crate_hash: hash,
     }
 }
@@ -509,7 +509,7 @@ pub fn symbol_hash(tcx: ty::ctxt,
     // to be independent of one another in the crate.
 
     symbol_hasher.reset();
-    symbol_hasher.input_str(link_meta.pkgid.name);
+    symbol_hasher.input_str(link_meta.crateid.name);
     symbol_hasher.input_str("-");
     symbol_hasher.input_str(link_meta.crate_hash);
     symbol_hasher.input_str("-");
@@ -669,7 +669,7 @@ pub fn mangle_exported_name(ccx: &CrateContext,
     let hash = get_symbol_hash(ccx, t);
     return exported_name(ccx.sess, path,
                          hash,
-                         ccx.link_meta.pkgid.version_or_default());
+                         ccx.link_meta.crateid.version_or_default());
 }
 
 pub fn mangle_internal_name_by_type_only(ccx: &CrateContext,
@@ -710,9 +710,9 @@ pub fn mangle_internal_name_by_path(ccx: &CrateContext, path: path) -> ~str {
 
 pub fn output_lib_filename(lm: &LinkMeta) -> ~str {
     format!("{}-{}-{}",
-            lm.pkgid.name,
+            lm.crateid.name,
             lm.crate_hash.slice_chars(0, 8),
-            lm.pkgid.version_or_default())
+            lm.crateid.version_or_default())
 }
 
 pub fn get_cc_prog(sess: Session) -> ~str {
diff --git a/src/librustc/metadata/common.rs b/src/librustc/metadata/common.rs
index bd6794b1d9f..8b3d5062e15 100644
--- a/src/librustc/metadata/common.rs
+++ b/src/librustc/metadata/common.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use std::cast;
-use syntax::pkgid::PkgId;
+use syntax::crateid::CrateId;
 
 // EBML enum definitions and utils shared by the encoder and decoder
 
@@ -206,6 +206,6 @@ pub static tag_native_libraries_kind: uint = 0x106;
 
 #[deriving(Clone)]
 pub struct LinkMeta {
-    pkgid: PkgId,
+    crateid: CrateId,
     crate_hash: @str,
 }
diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs
index 2c32c343ba8..8fa1e556394 100644
--- a/src/librustc/metadata/creader.rs
+++ b/src/librustc/metadata/creader.rs
@@ -25,7 +25,7 @@ use syntax::codemap::{Span, dummy_sp};
 use syntax::diagnostic::span_handler;
 use syntax::parse::token;
 use syntax::parse::token::ident_interner;
-use syntax::pkgid::PkgId;
+use syntax::crateid::CrateId;
 use syntax::visit;
 
 // Traverses an AST, reading all the information about use'd crates and extern
@@ -73,7 +73,7 @@ struct cache_entry {
     cnum: ast::CrateNum,
     span: Span,
     hash: @str,
-    pkgid: PkgId,
+    crateid: CrateId,
 }
 
 fn dump_crates(crate_cache: &[cache_entry]) {
@@ -89,10 +89,10 @@ fn warn_if_multiple_versions(e: &mut Env,
                              diag: @mut span_handler,
                              crate_cache: &[cache_entry]) {
     if crate_cache.len() != 0u {
-        let name = crate_cache[crate_cache.len() - 1].pkgid.name.clone();
+        let name = crate_cache[crate_cache.len() - 1].crateid.name.clone();
 
         let (matches, non_matches) = crate_cache.partitioned(|entry|
-            name == entry.pkgid.name);
+            name == entry.crateid.name);
 
         assert!(!matches.is_empty());
 
@@ -101,7 +101,7 @@ fn warn_if_multiple_versions(e: &mut Env,
                 format!("using multiple versions of crate `{}`", name));
             for match_ in matches.iter() {
                 diag.span_note(match_.span, "used here");
-                loader::note_pkgid_attr(diag, &match_.pkgid);
+                loader::note_crateid_attr(diag, &match_.crateid);
             }
         }
 
@@ -138,7 +138,7 @@ fn visit_view_item(e: &mut Env, i: &ast::view_item) {
                  ident, path_opt);
           let (name, version) = match path_opt {
               Some((path_str, _)) => {
-                  let crateid: Option<PkgId> = from_str(path_str);
+                  let crateid: Option<CrateId> = from_str(path_str);
                   match crateid {
                       None => (@"", @""),
                       Some(crateid) => {
@@ -245,12 +245,12 @@ fn visit_item(e: &Env, i: @ast::item) {
 fn existing_match(e: &Env, name: @str, version: @str, hash: &str) -> Option<ast::CrateNum> {
     let crate_cache = e.crate_cache.borrow();
     for c in crate_cache.get().iter() {
-        let pkgid_version = match c.pkgid.version {
+        let crateid_version = match c.crateid.version {
             None => @"0.0",
             Some(ref ver) => ver.to_managed(),
         };
-        if (name.is_empty() || c.pkgid.name.to_managed() == name) &&
-            (version.is_empty() || pkgid_version == version) &&
+        if (name.is_empty() || c.crateid.name.to_managed() == name) &&
+            (version.is_empty() || crateid_version == version) &&
             (hash.is_empty() || c.hash.as_slice() == hash) {
             return Some(c.cnum);
         }
@@ -293,7 +293,7 @@ fn resolve_crate(e: &mut Env,
                 cnum: cnum,
                 span: span,
                 hash: hash,
-                pkgid: pkgid,
+                crateid: crateid,
             });
         }
         e.next_crate_num += 1;
diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs
index a409887575a..b4c19c771dc 100644
--- a/src/librustc/metadata/decoder.rs
+++ b/src/librustc/metadata/decoder.rs
@@ -1175,7 +1175,7 @@ pub fn get_crate_vers(data: &[u8]) -> @str {
     let attrs = decoder::get_crate_attributes(data);
     match attr::find_crateid(attrs) {
         None => @"0.0",
-        Some(pkgid) => pkgid.version_or_default().to_managed(),
+        Some(crateid) => crateid.version_or_default().to_managed(),
     }
 }
 
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 7bd87f5dff8..73b0ac46cbd 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -1559,19 +1559,19 @@ fn encode_attributes(ebml_w: &mut writer::Encoder, attrs: &[Attribute]) {
     ebml_w.end_tag();
 }
 
-// So there's a special crate attribute called 'pkgid' which defines the
+// So there's a special crate attribute called 'crate_id' which defines the
 // metadata that Rust cares about for linking crates. If the user didn't
 // provide it we will throw it in anyway with a default value.
 fn synthesize_crate_attrs(ecx: &EncodeContext,
                           crate: &Crate) -> ~[Attribute] {
 
-    fn synthesize_pkgid_attr(ecx: &EncodeContext) -> Attribute {
-        assert!(!ecx.link_meta.pkgid.name.is_empty());
+    fn synthesize_crateid_attr(ecx: &EncodeContext) -> Attribute {
+        assert!(!ecx.link_meta.crateid.name.is_empty());
 
         attr::mk_attr(
             attr::mk_name_value_item_str(
                 @"crate_id",
-                ecx.link_meta.pkgid.to_str().to_managed()))
+                ecx.link_meta.crateid.to_str().to_managed()))
     }
 
     let mut attrs = ~[];
@@ -1580,7 +1580,7 @@ fn synthesize_crate_attrs(ecx: &EncodeContext,
             attrs.push(*attr);
         }
     }
-    attrs.push(synthesize_pkgid_attr(ecx));
+    attrs.push(synthesize_crateid_attr(ecx));
 
     attrs
 }
diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs
index 7c6be22208e..481a43d1ced 100644
--- a/src/librustc/metadata/loader.rs
+++ b/src/librustc/metadata/loader.rs
@@ -21,7 +21,7 @@ use metadata::filesearch;
 use syntax::codemap::Span;
 use syntax::diagnostic::span_handler;
 use syntax::parse::token::ident_interner;
-use syntax::pkgid::PkgId;
+use syntax::crateid::CrateId;
 use syntax::attr;
 use syntax::attr::AttrMetaMethods;
 
@@ -112,7 +112,7 @@ impl Context {
                             Some(cvec) =>
                                 if crate_matches(cvec.as_slice(), self.name,
                                                  self.version, self.hash) {
-                                    debug!("found {} with matching pkgid",
+                                    debug!("found {} with matching crate_id",
                                            path.display());
                                     let (rlib, dylib) = if file.ends_with(".rlib") {
                                         (Some(path.clone()), None)
@@ -126,7 +126,7 @@ impl Context {
                                     });
                                     FileMatches
                                 } else {
-                                    debug!("skipping {}, pkgid doesn't match",
+                                    debug!("skipping {}, crate_id doesn't match",
                                            path.display());
                                     FileDoesntMatch
                                 },
@@ -167,8 +167,8 @@ impl Context {
                     let attrs = decoder::get_crate_attributes(data);
                     match attr::find_crateid(attrs) {
                         None => {}
-                        Some(pkgid) => {
-                            note_pkgid_attr(self.sess.diagnostic(), &pkgid);
+                        Some(crateid) => {
+                            note_crateid_attr(self.sess.diagnostic(), &crateid);
                         }
                     }
                 }
@@ -231,9 +231,9 @@ impl Context {
     }
 }
 
-pub fn note_pkgid_attr(diag: @mut span_handler,
-                       pkgid: &PkgId) {
-    diag.handler().note(format!("pkgid: {}", pkgid.to_str()));
+pub fn note_crateid_attr(diag: @mut span_handler,
+                       crateid: &CrateId) {
+    diag.handler().note(format!("crate_id: {}", crateid.to_str()));
 }
 
 fn crate_matches(crate_data: &[u8],
@@ -243,13 +243,13 @@ fn crate_matches(crate_data: &[u8],
     let attrs = decoder::get_crate_attributes(crate_data);
     match attr::find_crateid(attrs) {
         None => false,
-        Some(pkgid) => {
+        Some(crateid) => {
             if !hash.is_empty() {
                 let chash = decoder::get_crate_hash(crate_data);
                 if chash != hash { return false; }
             }
-            name == pkgid.name.to_managed() &&
-                (version.is_empty() || version == pkgid.version_or_default().to_managed())
+            name == crateid.name.to_managed() &&
+                (version.is_empty() || version == crateid.version_or_default().to_managed())
         }
     }
 }
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index 0b2ee710e99..ce953ab3ab7 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -3048,8 +3048,8 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
     let sym_name = if is_top {
         ~"_rust_crate_map_toplevel"
     } else {
-        symname(sess, "_rust_crate_map_" + mapmeta.pkgid.name, mapmeta.crate_hash,
-                mapmeta.pkgid.version_or_default())
+        symname(sess, "_rust_crate_map_" + mapmeta.crateid.name, mapmeta.crate_hash,
+                mapmeta.crateid.version_or_default())
     };
 
     let slicetype = Type::struct_([int_type, int_type], false);
@@ -3168,8 +3168,8 @@ pub fn write_metadata(cx: &CrateContext, crate: &ast::Crate) -> ~[u8] {
                         flate::deflate_bytes(metadata);
     let llmeta = C_bytes(compressed);
     let llconst = C_struct([llmeta], false);
-    let name = format!("rust_metadata_{}_{}_{}", cx.link_meta.pkgid.name,
-                       cx.link_meta.pkgid.version_or_default(), cx.link_meta.crate_hash);
+    let name = format!("rust_metadata_{}_{}_{}", cx.link_meta.crateid.name,
+                       cx.link_meta.crateid.version_or_default(), cx.link_meta.crate_hash);
     let llglobal = name.with_c_str(|buf| {
         unsafe {
             llvm::LLVMAddGlobal(cx.metadata_llmod, val_ty(llconst).to_ref(), buf)
@@ -3205,7 +3205,7 @@ pub fn trans_crate(sess: session::Session,
     // crashes if the module identifer is same as other symbols
     // such as a function name in the module.
     // 1. http://llvm.org/bugs/show_bug.cgi?id=11479
-    let llmod_id = link_meta.pkgid.name.clone() + ".rc";
+    let llmod_id = link_meta.crateid.name.clone() + ".rc";
 
     let ccx = @CrateContext::new(sess,
                                      llmod_id,
diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs
index d81eaf8fab8..3e9aae4730e 100644
--- a/src/librustc/middle/trans/debuginfo.rs
+++ b/src/librustc/middle/trans/debuginfo.rs
@@ -2827,7 +2827,7 @@ fn namespace_for_item(cx: &CrateContext,
 
         if def_id.crate == ast::LOCAL_CRATE {
             // prepend crate name if not already present
-            let crate_namespace_ident = token::str_to_ident(cx.link_meta.pkgid.name);
+            let crate_namespace_ident = token::str_to_ident(cx.link_meta.crateid.name);
             item_path.insert(0, ast_map::path_mod(crate_namespace_ident));
         }
 
diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs
index bf7a0d6039b..9fcd0f458b3 100644
--- a/src/librustc/middle/trans/expr.rs
+++ b/src/librustc/middle/trans/expr.rs
@@ -1855,7 +1855,7 @@ pub fn trans_log_level(bcx: @Block) -> DatumBlock {
                 Some(&src) => {
                     ccx.sess.cstore.get_crate_data(src.crate).name
                 }
-                None => ccx.link_meta.pkgid.name.to_managed(),
+                None => ccx.link_meta.crateid.name.to_managed(),
             };
         };
         let mut modpath = ~[path_mod(ccx.sess.ident_of(srccrate))];
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index 0bd457b254c..f2526c29b9a 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -16,7 +16,7 @@ use codemap::{Span, Spanned, spanned, dummy_spanned};
 use codemap::BytePos;
 use diagnostic::span_handler;
 use parse::comments::{doc_comment_style, strip_doc_comment_decoration};
-use pkgid::PkgId;
+use crateid::CrateId;
 
 use std::hashmap::HashSet;
 
diff --git a/src/libsyntax/pkgid.rs b/src/libsyntax/crateid.rs
index 3c10e5199c9..0bb1eec512b 100644
--- a/src/libsyntax/pkgid.rs
+++ b/src/libsyntax/crateid.rs
@@ -8,15 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-/// PkgIds identify crates and include the crate name and optionall a path and
-/// version. In the full form, they look like relative URLs. Example:
+/// CrateIds identify crates and include the crate name and optionally a path
+/// and version. In the full form, they look like relative URLs. Example:
 /// `github.com/mozilla/rust#std:1.0` would be a package ID with a path of
 /// `gitub.com/mozilla/rust` and a crate name of `std` with a version of
 /// `1.0`. If no crate name is given after the hash, the name is inferred to
 /// be the last component of the path. If no version is given, it is inferred
 /// to be `0.0`.
 #[deriving(Clone, Eq)]
-pub struct PkgId {
+pub struct CrateId {
     /// A path which represents the codes origin. By convention this is the
     /// URL, without `http://` or `https://` prefix, to the crate's repository
     path: ~str,
@@ -26,7 +26,7 @@ pub struct PkgId {
     version: Option<~str>,
 }
 
-impl ToStr for PkgId {
+impl ToStr for CrateId {
     fn to_str(&self) -> ~str {
         let version = match self.version {
             None => "0.0",
@@ -40,8 +40,8 @@ impl ToStr for PkgId {
     }
 }
 
-impl FromStr for PkgId {
-    fn from_str(s: &str) -> Option<PkgId> {
+impl FromStr for CrateId {
+    fn from_str(s: &str) -> Option<CrateId> {
         let pieces: ~[&str] = s.splitn('#', 1).collect();
         let path = pieces[0].to_owned();
 
@@ -78,7 +78,7 @@ impl FromStr for PkgId {
             (name, version)
         };
 
-        Some(PkgId {
+        Some(CrateId {
             path: path,
             name: name,
             version: version,
@@ -86,7 +86,7 @@ impl FromStr for PkgId {
     }
 }
 
-impl PkgId {
+impl CrateId {
     pub fn version_or_default<'a>(&'a self) -> &'a str {
         match self.version {
             None => "0.0",
@@ -97,90 +97,90 @@ impl PkgId {
 
 #[test]
 fn bare_name() {
-    let pkgid: PkgId = from_str("foo").expect("valid pkgid");
-    assert_eq!(pkgid.name, ~"foo");
-    assert_eq!(pkgid.version, None);
-    assert_eq!(pkgid.path, ~"foo");
+    let crateid: CrateId = from_str("foo").expect("valid crateid");
+    assert_eq!(crateid.name, ~"foo");
+    assert_eq!(crateid.version, None);
+    assert_eq!(crateid.path, ~"foo");
 }
 
 #[test]
 fn bare_name_single_char() {
-    let pkgid: PkgId = from_str("f").expect("valid pkgid");
-    assert_eq!(pkgid.name, ~"f");
-    assert_eq!(pkgid.version, None);
-    assert_eq!(pkgid.path, ~"f");
+    let crateid: CrateId = from_str("f").expect("valid crateid");
+    assert_eq!(crateid.name, ~"f");
+    assert_eq!(crateid.version, None);
+    assert_eq!(crateid.path, ~"f");
 }
 
 #[test]
-fn empty_pkgid() {
-    let pkgid: Option<PkgId> = from_str("");
-    assert!(pkgid.is_none());
+fn empty_crateid() {
+    let crateid: Option<CrateId> = from_str("");
+    assert!(crateid.is_none());
 }
 
 #[test]
 fn simple_path() {
-    let pkgid: PkgId = from_str("example.com/foo/bar").expect("valid pkgid");
-    assert_eq!(pkgid.name, ~"bar");
-    assert_eq!(pkgid.version, None);
-    assert_eq!(pkgid.path, ~"example.com/foo/bar");
+    let crateid: CrateId = from_str("example.com/foo/bar").expect("valid crateid");
+    assert_eq!(crateid.name, ~"bar");
+    assert_eq!(crateid.version, None);
+    assert_eq!(crateid.path, ~"example.com/foo/bar");
 }
 
 #[test]
 fn simple_version() {
-    let pkgid: PkgId = from_str("foo#1.0").expect("valid pkgid");
-    assert_eq!(pkgid.name, ~"foo");
-    assert_eq!(pkgid.version, Some(~"1.0"));
-    assert_eq!(pkgid.path, ~"foo");
+    let crateid: CrateId = from_str("foo#1.0").expect("valid crateid");
+    assert_eq!(crateid.name, ~"foo");
+    assert_eq!(crateid.version, Some(~"1.0"));
+    assert_eq!(crateid.path, ~"foo");
 }
 
 #[test]
 fn absolute_path() {
-    let pkgid: Option<PkgId> = from_str("/foo/bar");
-    assert!(pkgid.is_none());
+    let crateid: Option<CrateId> = from_str("/foo/bar");
+    assert!(crateid.is_none());
 }
 
 #[test]
 fn path_ends_with_slash() {
-    let pkgid: Option<PkgId> = from_str("foo/bar/");
-    assert!(pkgid.is_none());
+    let crateid: Option<CrateId> = from_str("foo/bar/");
+    assert!(crateid.is_none());
 }
 
 #[test]
 fn path_and_version() {
-    let pkgid: PkgId = from_str("example.com/foo/bar#1.0").expect("valid pkgid");
-    assert_eq!(pkgid.name, ~"bar");
-    assert_eq!(pkgid.version, Some(~"1.0"));
-    assert_eq!(pkgid.path, ~"example.com/foo/bar");
+    let crateid: CrateId = from_str("example.com/foo/bar#1.0").expect("valid crateid");
+    assert_eq!(crateid.name, ~"bar");
+    assert_eq!(crateid.version, Some(~"1.0"));
+    assert_eq!(crateid.path, ~"example.com/foo/bar");
 }
 
 #[test]
 fn single_chars() {
-    let pkgid: PkgId = from_str("a/b#1").expect("valid pkgid");
-    assert_eq!(pkgid.name, ~"b");
-    assert_eq!(pkgid.version, Some(~"1"));
-    assert_eq!(pkgid.path, ~"a/b");
+    let crateid: CrateId = from_str("a/b#1").expect("valid crateid");
+    assert_eq!(crateid.name, ~"b");
+    assert_eq!(crateid.version, Some(~"1"));
+    assert_eq!(crateid.path, ~"a/b");
 }
 
 #[test]
 fn missing_version() {
-    let pkgid: PkgId = from_str("foo#").expect("valid pkgid");
-    assert_eq!(pkgid.name, ~"foo");
-    assert_eq!(pkgid.version, None);
-    assert_eq!(pkgid.path, ~"foo");
+    let crateid: CrateId = from_str("foo#").expect("valid crateid");
+    assert_eq!(crateid.name, ~"foo");
+    assert_eq!(crateid.version, None);
+    assert_eq!(crateid.path, ~"foo");
 }
 
 #[test]
 fn path_and_name() {
-    let pkgid: PkgId = from_str("foo/rust-bar#bar:1.0").expect("valid pkgid");
-    assert_eq!(pkgid.name, ~"bar");
-    assert_eq!(pkgid.version, Some(~"1.0"));
-    assert_eq!(pkgid.path, ~"foo/rust-bar");
+    let crateid: CrateId = from_str("foo/rust-bar#bar:1.0").expect("valid crateid");
+    assert_eq!(crateid.name, ~"bar");
+    assert_eq!(crateid.version, Some(~"1.0"));
+    assert_eq!(crateid.path, ~"foo/rust-bar");
 }
 
 #[test]
 fn empty_name() {
-    let pkgid: PkgId = from_str("foo/bar#:1.0").expect("valid pkgid");
-    assert_eq!(pkgid.name, ~"bar");
-    assert_eq!(pkgid.version, Some(~"1.0"));
-    assert_eq!(pkgid.path, ~"foo/bar");
+    let crateid: CrateId = from_str("foo/bar#:1.0").expect("valid crateid");
+    assert_eq!(crateid.name, ~"bar");
+    assert_eq!(crateid.version, Some(~"1.0"));
+    assert_eq!(crateid.path, ~"foo/bar");
 }
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index a8c5ba0153d..9631849235e 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -47,7 +47,7 @@ pub mod fold;
 
 
 pub mod parse;
-pub mod pkgid;
+pub mod crateid;
 
 pub mod print {
     pub mod pp;