mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Improve sorting in debug_dump
.
Currently it sorts by symbol name, which is a mangled name like `_ZN1a4main17hb29587cdb6db5f42E`, which leads to non-obvious orderings. This commit changes it to use the existing `items_in_deterministic_order`, which iterates in source code order.
This commit is contained in:
parent
0a1cd5baa4
commit
9fd6d97915
@ -864,15 +864,10 @@ fn debug_dump<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx>, label: &str, cgus: &[CodegenUnit<
|
||||
cgu.size_estimate()
|
||||
);
|
||||
|
||||
// The order of `cgu.items()` is non-deterministic; sort it by name
|
||||
// to give deterministic output.
|
||||
let mut items: Vec<_> = cgu.items().iter().collect();
|
||||
items.sort_by_key(|(item, _)| item.symbol_name(tcx).name);
|
||||
for (item, linkage) in items {
|
||||
for (item, linkage) in cgu.items_in_deterministic_order(tcx) {
|
||||
let symbol_name = item.symbol_name(tcx).name;
|
||||
let symbol_hash_start = symbol_name.rfind('h');
|
||||
let symbol_hash = symbol_hash_start.map_or("<no hash>", |i| &symbol_name[i..]);
|
||||
|
||||
let size = item.size_estimate(tcx);
|
||||
let _ = with_no_trimmed_paths!(writeln!(
|
||||
s,
|
||||
|
Loading…
Reference in New Issue
Block a user