Skip to content

Commit b48e699

Browse files
committed
auto merge of #5509 : thestinger/rust/oldmap, r=brson
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.
2 parents d469212 + a919e5e commit b48e699

File tree

4 files changed

+42
-347
lines changed

4 files changed

+42
-347
lines changed

src/librustc/metadata/cstore.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,24 +141,28 @@ pub fn find_extern_mod_stmt_cnum(cstore: @mut CStore,
141141
extern_mod_crate_map.find(&emod_id)
142142
}
143143

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

150150
let extern_mod_crate_map = cstore.extern_mod_crate_map;
151151
for extern_mod_crate_map.each_value |&cnum| {
152152
let cdata = cstore::get_crate_data(cstore, cnum);
153153
let hash = decoder::get_crate_hash(cdata.data);
154-
debug!("Add hash[%s]: %s", *cdata.name, *hash);
154+
let vers = decoder::get_crate_vers(cdata.data);
155+
debug!("Add hash[%s]: %s %s", *cdata.name, *vers, *hash);
155156
result.push(crate_hash {
156157
name: cdata.name,
158+
vers: vers,
157159
hash: hash
158160
});
159161
}
160162

161-
let sorted = std::sort::merge_sort(result, |a, b| a.name <= b.name);
163+
let sorted = do std::sort::merge_sort(result) |a, b| {
164+
(a.name, a.vers, a.hash) <= (b.name, b.vers, b.hash)
165+
};
162166

163167
debug!("sorted:");
164168
for sorted.each |x| {

src/librustc/middle/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4741,8 +4741,8 @@ pub impl Resolver {
47414741
let mut j = this.value_ribs.len();
47424742
while j != 0 {
47434743
j -= 1;
4744-
for this.value_ribs[j].bindings.each_entry |e| {
4745-
vec::push(&mut maybes, copy *this.session.str_of(e.key));
4744+
for this.value_ribs[j].bindings.each_key |&k| {
4745+
vec::push(&mut maybes, copy *this.session.str_of(k));
47464746
vec::push(&mut values, uint::max_value);
47474747
}
47484748
}

0 commit comments

Comments
 (0)