Skip to content

Commit acd91e2

Browse files
authored
Rollup merge of rust-lang#146987 - hkBst:sort-params-1, r=nnethercote
impl Ord for params and use unstable sort AFAICT we are only sorting to find duplicates, so unstable sort should work fine, and maybe is a tiny bit faster?
2 parents cf07cce + 431ef03 commit acd91e2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_hir_analysis/src/constrained_generic_params.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable, TypeV
44
use rustc_span::Span;
55
use tracing::debug;
66

7-
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
7+
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
88
pub(crate) struct Parameter(pub u32);
99

1010
impl From<ty::ParamTy> for Parameter {

compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ fn check_duplicate_params<'tcx>(
275275
span: Span,
276276
) -> Result<(), ErrorGuaranteed> {
277277
let mut base_params = cgp::parameters_for(tcx, parent_args, true);
278-
base_params.sort_by_key(|param| param.0);
278+
base_params.sort_unstable();
279279
if let (_, [duplicate, ..]) = base_params.partition_dedup() {
280280
let param = impl1_args[duplicate.0 as usize];
281281
return Err(tcx

0 commit comments

Comments
 (0)