Skip to content

Commit 94d7501

Browse files
Remove redundant sorting of projections in TypeIdHasher.
1 parent 5c923f0 commit 94d7501

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/librustc/ty/util.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -458,15 +458,11 @@ impl<'a, 'gcx, 'tcx> TypeVisitor<'tcx> for TypeIdHasher<'a, 'gcx, 'tcx> {
458458
data.region_bound.visit_with(self);
459459
self.hash(data.builtin_bounds);
460460

461-
// Only projection bounds are left, sort and hash them.
462-
let mut projection_bounds: Vec<_> = data.projection_bounds
463-
.iter()
464-
.map(|b| (b.item_name().as_str(), b))
465-
.collect();
466-
projection_bounds.sort_by_key(|&(ref name, _)| name.clone());
467-
for (name, bound) in projection_bounds {
461+
// Only projection bounds are left, hash them.
462+
self.hash(data.projection_bounds.len());
463+
for bound in &data.projection_bounds {
468464
self.def_id(bound.0.trait_ref.def_id);
469-
self.hash(name);
465+
self.hash(bound.0.item_name);
470466
bound.visit_with(self);
471467
}
472468

0 commit comments

Comments
 (0)