Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

turn std::oldmap into a wrapper around LinearMap #5509

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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