Skip to content

Commit 17dfae7

Browse files
committed
Auto merge of #93089 - pierwill:rm-outlivesconstraint-ord, r=michaelwoerister
Remove ordering traits from `OutlivesConstraint` In two cases where this ordering was used, I've replaced the sorting to use a key that does not rely on `DefId` being `Ord`. This is part of #90317. If I understand correctly, whether this is correct depends on whether the `RegionVid`s are tracked during incremental compilation. But I might be mistaken in this approach. cc `@cjgillot`
2 parents df368ae + 7f16d0e commit 17dfae7

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)