Skip to content

Commit b9cb201

Browse files
authored
Rollup merge of #131328 - ismailarilik:remove-unnecessary-sorts-in-rustc-hir-analysis, r=compiler-errors
Remove unnecessary sorts in `rustc_hir_analysis` A follow-up after #131140. Here the related objects are `IndexSet` so do not require a sort to stay stable. And they don't need to be `mut` anymore. r? ```@compiler-errors```
2 parents 13e07b9 + a0e687f commit b9cb201

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) {
531531
debug!(?required_bounds);
532532
let param_env = tcx.param_env(gat_def_id);
533533

534-
let mut unsatisfied_bounds: Vec<_> = required_bounds
534+
let unsatisfied_bounds: Vec<_> = required_bounds
535535
.into_iter()
536536
.filter(|clause| match clause.kind().skip_binder() {
537537
ty::ClauseKind::RegionOutlives(ty::OutlivesPredicate(a, b)) => {
@@ -552,9 +552,6 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) {
552552
.map(|clause| clause.to_string())
553553
.collect();
554554

555-
// We sort so that order is predictable
556-
unsatisfied_bounds.sort();
557-
558555
if !unsatisfied_bounds.is_empty() {
559556
let plural = pluralize!(unsatisfied_bounds.len());
560557
let suggestion = format!(

compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,7 @@ impl<'tcx> InherentOverlapChecker<'tcx> {
319319
// List of connected regions is built. Now, run the overlap check
320320
// for each pair of impl blocks in the same connected region.
321321
for region in connected_regions.into_iter().flatten() {
322-
let mut impl_blocks =
323-
region.impl_blocks.into_iter().collect::<SmallVec<[usize; 8]>>();
324-
impl_blocks.sort_unstable();
322+
let impl_blocks = region.impl_blocks.into_iter().collect::<SmallVec<[usize; 8]>>();
325323
for (i, &impl1_items_idx) in impl_blocks.iter().enumerate() {
326324
let &(&impl1_def_id, impl_items1) = &impls_items[impl1_items_idx];
327325
res = res.and(self.check_for_duplicate_items_in_impl(impl1_def_id));

0 commit comments

Comments
 (0)