Skip to content

Commit

Permalink
Rollup merge of #133362 - compiler-errors:existential-preds, r=BoxyUwU
Browse files Browse the repository at this point in the history
No need to re-sort existential preds in relate impl

We already assert that these predicates are in the right ordering in `mk_poly_existential_predicates`.

r? types
  • Loading branch information
compiler-errors authored Nov 26, 2024
2 parents 3e1a089 + b5fc3a1 commit 479de1f
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions compiler/rustc_middle/src/ty/relate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::iter;
pub use rustc_type_ir::relate::*;

use crate::ty::error::{ExpectedFound, TypeError};
use crate::ty::predicate::ExistentialPredicateStableCmpExt as _;
use crate::ty::{self as ty, Ty, TyCtxt};

pub type RelateResult<'tcx, T> = rustc_type_ir::relate::RelateResult<TyCtxt<'tcx>, T>;
Expand Down Expand Up @@ -86,10 +85,7 @@ impl<'tcx> Relate<TyCtxt<'tcx>> for &'tcx ty::List<ty::PolyExistentialPredicate<
// in `a`.
let mut a_v: Vec<_> = a.into_iter().collect();
let mut b_v: Vec<_> = b.into_iter().collect();
// `skip_binder` here is okay because `stable_cmp` doesn't look at binders
a_v.sort_by(|a, b| a.skip_binder().stable_cmp(tcx, &b.skip_binder()));
a_v.dedup();
b_v.sort_by(|a, b| a.skip_binder().stable_cmp(tcx, &b.skip_binder()));
b_v.dedup();
if a_v.len() != b_v.len() {
return Err(TypeError::ExistentialMismatch(ExpectedFound::new(a, b)));
Expand Down

0 comments on commit 479de1f

Please sign in to comment.