@@ -141,24 +141,28 @@ pub fn find_extern_mod_stmt_cnum(cstore: @mut CStore,
141
141
extern_mod_crate_map. find ( & emod_id)
142
142
}
143
143
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)
146
146
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 }
148
148
let mut result = ~[ ] ;
149
149
150
150
let extern_mod_crate_map = cstore. extern_mod_crate_map ;
151
151
for extern_mod_crate_map. each_value |& cnum| {
152
152
let cdata = cstore:: get_crate_data ( cstore, cnum) ;
153
153
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) ;
155
156
result. push ( crate_hash {
156
157
name : cdata. name ,
158
+ vers : vers,
157
159
hash : hash
158
160
} ) ;
159
161
}
160
162
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
+ } ;
162
166
163
167
debug ! ( "sorted:" ) ;
164
168
for sorted. each |x| {
0 commit comments