Skip to content

Commit 4bc0971

Browse files
committed
Rename pkgid variables
1 parent aa5d779 commit 4bc0971

File tree

9 files changed

+24
-24
lines changed

9 files changed

+24
-24
lines changed

src/librustc/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ pub fn build_link_meta(sess: Session,
475475
truncated_hash_result(symbol_hasher).to_managed()
476476
}
477477

478-
let pkgid = match attr::find_pkgid(attrs) {
478+
let crateid = match attr::find_crateid(attrs) {
479479
None => {
480480
let stem = session::expect(
481481
sess,

src/librustc/driver/driver.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,12 +1030,12 @@ pub fn build_output_filenames(input: &input,
10301030
str_input(_) => @"rust_out"
10311031
};
10321032

1033-
// If a pkgid is present, we use it as the link name
1034-
let pkgid = attr::find_pkgid(attrs);
1035-
match pkgid {
1033+
// If a crateid is present, we use it as the link name
1034+
let crateid = attr::find_crateid(attrs);
1035+
match crateid {
10361036
None => {}
1037-
Some(pkgid) => {
1038-
stem = pkgid.name.to_managed()
1037+
Some(crateid) => {
1038+
stem = crateid.name.to_managed()
10391039
}
10401040
}
10411041

src/librustc/front/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ fn mk_tests(cx: &TestCtxt) -> @ast::item {
385385
}
386386

387387
fn is_extra(crate: &ast::Crate) -> bool {
388-
match attr::find_pkgid(crate.attrs) {
388+
match attr::find_crateid(crate.attrs) {
389389
Some(ref s) if "extra" == s.name => true,
390390
_ => false
391391
}

src/librustc/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,18 +292,18 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
292292
let t_outputs = d::build_output_filenames(&input, &odir, &ofile,
293293
attrs, sess);
294294
if crate_id || crate_name {
295-
let pkgid = match attr::find_pkgid(attrs) {
296-
Some(pkgid) => pkgid,
295+
let crateid = match attr::find_crateid(attrs) {
296+
Some(crateid) => crateid,
297297
None => {
298298
sess.fatal("No crate_id and --crate-id or \
299299
--crate-name requested")
300300
}
301301
};
302302
if crate_id {
303-
println(pkgid.to_str());
303+
println(crateid.to_str());
304304
}
305305
if crate_name {
306-
println(pkgid.name);
306+
println(crateid.name);
307307
}
308308
}
309309

src/librustc/metadata/creader.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ fn visit_view_item(e: &mut Env, i: &ast::view_item) {
138138
ident, path_opt);
139139
let (name, version) = match path_opt {
140140
Some((path_str, _)) => {
141-
let pkgid: Option<PkgId> = from_str(path_str);
142-
match pkgid {
141+
let crateid: Option<PkgId> = from_str(path_str);
142+
match crateid {
143143
None => (@"", @""),
144-
Some(pkgid) => {
145-
let version = match pkgid.version {
144+
Some(crateid) => {
145+
let version = match crateid.version {
146146
None => @"",
147147
Some(ref ver) => ver.to_managed(),
148148
};
149-
(pkgid.name.to_managed(), version)
149+
(crateid.name.to_managed(), version)
150150
}
151151
}
152152
}
@@ -282,7 +282,7 @@ fn resolve_crate(e: &mut Env,
282282
} = load_ctxt.load_library_crate();
283283

284284
let attrs = decoder::get_crate_attributes(metadata.as_slice());
285-
let pkgid = attr::find_pkgid(attrs).unwrap();
285+
let crateid = attr::find_crateid(attrs).unwrap();
286286
let hash = decoder::get_crate_hash(metadata.as_slice());
287287

288288
// Claim this crate number and cache it

src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ pub fn get_crate_hash(data: &[u8]) -> @str {
11731173

11741174
pub fn get_crate_vers(data: &[u8]) -> @str {
11751175
let attrs = decoder::get_crate_attributes(data);
1176-
match attr::find_pkgid(attrs) {
1176+
match attr::find_crateid(attrs) {
11771177
None => @"0.0",
11781178
Some(pkgid) => pkgid.version_or_default().to_managed(),
11791179
}

src/librustc/metadata/loader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl Context {
165165
}
166166
let data = lib.metadata.as_slice();
167167
let attrs = decoder::get_crate_attributes(data);
168-
match attr::find_pkgid(attrs) {
168+
match attr::find_crateid(attrs) {
169169
None => {}
170170
Some(pkgid) => {
171171
note_pkgid_attr(self.sess.diagnostic(), &pkgid);
@@ -241,7 +241,7 @@ fn crate_matches(crate_data: &[u8],
241241
version: @str,
242242
hash: @str) -> bool {
243243
let attrs = decoder::get_crate_attributes(crate_data);
244-
match attr::find_pkgid(attrs) {
244+
match attr::find_crateid(attrs) {
245245
None => false,
246246
Some(pkgid) => {
247247
if !hash.is_empty() {

src/librustdoc/clean.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub struct Crate {
7373

7474
impl Clean<Crate> for visit_ast::RustdocVisitor {
7575
fn clean(&self) -> Crate {
76-
use syntax::attr::find_pkgid;
76+
use syntax::attr::find_crateid;
7777
let cx = local_data::get(super::ctxtkey, |x| *x.unwrap());
7878

7979
let mut externs = HashMap::new();
@@ -82,7 +82,7 @@ impl Clean<Crate> for visit_ast::RustdocVisitor {
8282
});
8383

8484
Crate {
85-
name: match find_pkgid(self.attrs) {
85+
name: match find_crateid(self.attrs) {
8686
Some(n) => n.name,
8787
None => fail!("rustdoc requires a `crate_id` crate attribute"),
8888
},

src/libsyntax/attr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,10 @@ pub fn find_linkage_metas(attrs: &[Attribute]) -> ~[@MetaItem] {
234234
result
235235
}
236236

237-
pub fn find_pkgid(attrs: &[Attribute]) -> Option<PkgId> {
237+
pub fn find_crateid(attrs: &[Attribute]) -> Option<CrateId> {
238238
match first_attr_value_str_by_name(attrs, "crate_id") {
239239
None => None,
240-
Some(id) => from_str::<PkgId>(id),
240+
Some(id) => from_str::<CrateId>(id),
241241
}
242242
}
243243

0 commit comments

Comments
 (0)