Rollup merge of #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?
This commit is contained in:
commit
acd91e2fe1
2 changed files with 2 additions and 2 deletions
|
|
@ -4,7 +4,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable, TypeV
|
|||
use rustc_span::Span;
|
||||
use tracing::debug;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
pub(crate) struct Parameter(pub u32);
|
||||
|
||||
impl From<ty::ParamTy> for Parameter {
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ fn check_duplicate_params<'tcx>(
|
|||
span: Span,
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
let mut base_params = cgp::parameters_for(tcx, parent_args, true);
|
||||
base_params.sort_by_key(|param| param.0);
|
||||
base_params.sort_unstable();
|
||||
if let (_, [duplicate, ..]) = base_params.partition_dedup() {
|
||||
let param = impl1_args[duplicate.0 as usize];
|
||||
return Err(tcx
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue