Skip to content

Commit 7f16d0e

Browse files
committed
Remove ordering traits from rustc_borrowck::constraints::OutlivesConstraint
In two cases where this ordering was used, I've replaced the sorting to use a key that does not include DefId. I'm not sure this is correct in terms of our goals from #90317, or otherwise.
1 parent 2f004d2 commit 7f16d0e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

compiler/rustc_borrowck/src/constraints/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'tcx> Index<OutlivesConstraintIndex> for OutlivesConstraintSet<'tcx> {
7272
}
7373
}
7474

75-
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
75+
#[derive(Clone, PartialEq, Eq)]
7676
pub struct OutlivesConstraint<'tcx> {
7777
// NB. The ordering here is not significant for correctness, but
7878
// it is for convenience. Before we dump the constraints in the

compiler/rustc_borrowck/src/region_infer/dump_mir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
7272
}
7373

7474
let mut constraints: Vec<_> = self.constraints.outlives().iter().collect();
75-
constraints.sort();
75+
constraints.sort_by_key(|c| (c.sup, c.sub));
7676
for constraint in &constraints {
7777
let OutlivesConstraint { sup, sub, locations, category, variance_info: _ } = constraint;
7878
let (name, arg) = match locations {

compiler/rustc_borrowck/src/region_infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
612612
fn propagate_constraints(&mut self, _body: &Body<'tcx>) {
613613
debug!("constraints={:#?}", {
614614
let mut constraints: Vec<_> = self.constraints.outlives().iter().collect();
615-
constraints.sort();
615+
constraints.sort_by_key(|c| (c.sup, c.sub));
616616
constraints
617617
.into_iter()
618618
.map(|c| (c, self.constraint_sccs.scc(c.sup), self.constraint_sccs.scc(c.sub)))

0 commit comments

Comments
 (0)