Skip to content

Commit faad4ea

Browse files
incr.comp.: Sort exported symbols list in order to achieve stable incr. comp. hash.
1 parent 102eaa5 commit faad4ea

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/librustc_trans/back/symbol_export.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ pub fn provide_local(providers: &mut Providers) {
125125
None,
126126
SymbolExportLevel::Rust));
127127
}
128+
129+
// Sort so we get a stable incr. comp. hash.
130+
local_crate.sort_unstable_by(|&(ref name1, ..), &(ref name2, ..)| {
131+
name1.cmp(name2)
132+
});
133+
128134
Arc::new(local_crate)
129135
};
130136
}
@@ -148,7 +154,7 @@ pub fn provide_extern(providers: &mut Providers) {
148154
let special_runtime_crate =
149155
tcx.is_panic_runtime(cnum) || tcx.is_compiler_builtins(cnum);
150156

151-
let crate_exports = tcx
157+
let mut crate_exports: Vec<_> = tcx
152158
.exported_symbol_ids(cnum)
153159
.iter()
154160
.map(|&def_id| {
@@ -176,6 +182,11 @@ pub fn provide_extern(providers: &mut Providers) {
176182
})
177183
.collect();
178184

185+
// Sort so we get a stable incr. comp. hash.
186+
crate_exports.sort_unstable_by(|&(ref name1, ..), &(ref name2, ..)| {
187+
name1.cmp(name2)
188+
});
189+
179190
Arc::new(crate_exports)
180191
};
181192
}

0 commit comments

Comments
 (0)