Skip to content

Commit b8c5821

Browse files
committed
Fix Dominators::rank_partial_cmp to match documentation
The only use site is also updated accordingly and there is no change in end-to-end behaviour.
1 parent 1f72129 commit b8c5821

File tree

2 files changed

+6
-6
lines changed
  • compiler
    • rustc_data_structures/src/graph/dominators
    • rustc_mir_transform/src/coverage

2 files changed

+6
-6
lines changed

compiler/rustc_data_structures/src/graph/dominators/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl<Node: Idx> Dominators<Node> {
299299
/// of two unrelated nodes will also be consistent, but otherwise the order has no
300300
/// meaning.) This method cannot be used to determine if either Node dominates the other.
301301
pub fn rank_partial_cmp(&self, lhs: Node, rhs: Node) -> Option<Ordering> {
302-
self.post_order_rank[lhs].partial_cmp(&self.post_order_rank[rhs])
302+
self.post_order_rank[rhs].partial_cmp(&self.post_order_rank[lhs])
303303
}
304304
}
305305

compiler/rustc_mir_transform/src/coverage/spans.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,11 @@ impl<'a, 'tcx> CoverageSpans<'a, 'tcx> {
341341
if a.is_in_same_bcb(b) {
342342
Some(Ordering::Equal)
343343
} else {
344-
// Sort equal spans by dominator relationship, in reverse order (so
345-
// dominators always come after the dominated equal spans). When later
346-
// comparing two spans in order, the first will either dominate the second,
347-
// or they will have no dominator relationship.
348-
self.basic_coverage_blocks.dominators().rank_partial_cmp(b.bcb, a.bcb)
344+
// Sort equal spans by dominator relationship (so dominators always come
345+
// before the dominated equal spans). When later comparing two spans in
346+
// order, the first will either dominate the second, or they will have no
347+
// dominator relationship.
348+
self.basic_coverage_blocks.dominators().rank_partial_cmp(a.bcb, b.bcb)
349349
}
350350
} else {
351351
// Sort hi() in reverse order so shorter spans are attempted after longer spans.

0 commit comments

Comments
 (0)