Skip to content

Commit

Permalink
Use sort_by_cached_key for partitioning
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Apr 9, 2018
1 parent 2cc52f0 commit e7aa139
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/librustc_mir/monomorphize/partitioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,9 @@ pub trait CodegenUnitExt<'tcx> {
}, item.symbol_name(tcx))
}

let items: Vec<_> = self.items().iter().map(|(&i, &l)| (i, l)).collect();
let mut items : Vec<_> = items.iter()
.map(|il| (il, item_sort_key(tcx, il.0))).collect();
items.sort_by(|&(_, ref key1), &(_, ref key2)| key1.cmp(key2));
items.into_iter().map(|(&item_linkage, _)| item_linkage).collect()
let mut items: Vec<_> = self.items().iter().map(|(&i, &l)| (i, l)).collect();
items.sort_by_cached_key(|&(i, _)| item_sort_key(tcx, i));
items
}
}

Expand Down

0 comments on commit e7aa139

Please sign in to comment.