diff options
| author | bors <bors@rust-lang.org> | 2022-01-25 08:18:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-01-25 08:18:25 +0000 |
| commit | 17dfae79bbc3dabe1427073086acf7f7bd45148c (patch) | |
| tree | a4117ad8152cbc222346846748b75f3139933d87 | |
| parent | df368ae457c54fb95d3e64f9986a5f171a6370f0 (diff) | |
| parent | 7f16d0ed54b3497e8b26bc68cdf9a7590f3be816 (diff) | |
| download | rust-17dfae79bbc3dabe1427073086acf7f7bd45148c.tar.gz rust-17dfae79bbc3dabe1427073086acf7f7bd45148c.zip | |
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`
| -rw-r--r-- | compiler/rustc_borrowck/src/constraints/mod.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_borrowck/src/region_infer/dump_mir.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_borrowck/src/region_infer/mod.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_borrowck/src/constraints/mod.rs b/compiler/rustc_borrowck/src/constraints/mod.rs index 98378a98684..d41143ee763 100644 --- a/compiler/rustc_borrowck/src/constraints/mod.rs +++ b/compiler/rustc_borrowck/src/constraints/mod.rs @@ -72,7 +72,7 @@ impl<'tcx> Index<OutlivesConstraintIndex> for OutlivesConstraintSet<'tcx> { } } -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, PartialEq, Eq)] pub struct OutlivesConstraint<'tcx> { // NB. The ordering here is not significant for correctness, but // it is for convenience. Before we dump the constraints in the diff --git a/compiler/rustc_borrowck/src/region_infer/dump_mir.rs b/compiler/rustc_borrowck/src/region_infer/dump_mir.rs index cfd3acb6bde..97233b930c3 100644 --- a/compiler/rustc_borrowck/src/region_infer/dump_mir.rs +++ b/compiler/rustc_borrowck/src/region_infer/dump_mir.rs @@ -72,7 +72,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { } let mut constraints: Vec<_> = self.constraints.outlives().iter().collect(); - constraints.sort(); + constraints.sort_by_key(|c| (c.sup, c.sub)); for constraint in &constraints { let OutlivesConstraint { sup, sub, locations, category, variance_info: _ } = constraint; let (name, arg) = match locations { diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs index b39a28f79aa..d9120ff2457 100644 --- a/compiler/rustc_borrowck/src/region_infer/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/mod.rs @@ -612,7 +612,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn propagate_constraints(&mut self, _body: &Body<'tcx>) { debug!("constraints={:#?}", { let mut constraints: Vec<_> = self.constraints.outlives().iter().collect(); - constraints.sort(); + constraints.sort_by_key(|c| (c.sup, c.sub)); constraints .into_iter() .map(|c| (c, self.constraint_sccs.scc(c.sup), self.constraint_sccs.scc(c.sub))) |
