Skip to content

Commit

Permalink
auto merge of #5509 : thestinger/rust/oldmap, r=brson
Browse files Browse the repository at this point in the history
The reasoning for doing it this way is that it's much easier to transition method-by-method to the `Map` API than trying to do the migration all at once.

I found an issue unrelated to my changes in one of the run-fail tests - if it uses `LinearMap`, it still fails but exits with 0. I xfailed it for now and opened [an issue](#5512), because it's not caused by these changes.
  • Loading branch information
bors committed Mar 26, 2013
2 parents d469212 + a919e5e commit b48e699
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 347 deletions.
14 changes: 9 additions & 5 deletions src/librustc/metadata/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,28 @@ pub fn find_extern_mod_stmt_cnum(cstore: @mut CStore,
extern_mod_crate_map.find(&emod_id)
}

// returns hashes of crates directly used by this crate. Hashes are
// sorted by crate name.
// returns hashes of crates directly used by this crate. Hashes are sorted by
// (crate name, crate version, crate hash) in lexicographic order (not semver)
pub fn get_dep_hashes(cstore: @mut CStore) -> ~[~str] {
struct crate_hash { name: @~str, hash: @~str }
struct crate_hash { name: @~str, vers: @~str, hash: @~str }
let mut result = ~[];

let extern_mod_crate_map = cstore.extern_mod_crate_map;
for extern_mod_crate_map.each_value |&cnum| {
let cdata = cstore::get_crate_data(cstore, cnum);
let hash = decoder::get_crate_hash(cdata.data);
debug!("Add hash[%s]: %s", *cdata.name, *hash);
let vers = decoder::get_crate_vers(cdata.data);
debug!("Add hash[%s]: %s %s", *cdata.name, *vers, *hash);
result.push(crate_hash {
name: cdata.name,
vers: vers,
hash: hash
});
}

let sorted = std::sort::merge_sort(result, |a, b| a.name <= b.name);
let sorted = do std::sort::merge_sort(result) |a, b| {
(a.name, a.vers, a.hash) <= (b.name, b.vers, b.hash)
};

debug!("sorted:");
for sorted.each |x| {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4741,8 +4741,8 @@ pub impl Resolver {
let mut j = this.value_ribs.len();
while j != 0 {
j -= 1;
for this.value_ribs[j].bindings.each_entry |e| {
vec::push(&mut maybes, copy *this.session.str_of(e.key));
for this.value_ribs[j].bindings.each_key |&k| {
vec::push(&mut maybes, copy *this.session.str_of(k));
vec::push(&mut values, uint::max_value);
}
}
Expand Down
Loading

0 comments on commit b48e699

Please sign in to comment.