Skip to content

Commit 53aca55

Browse files
committed
Auto merge of #65172 - tanriol:explain_borrow-use-context-dominators, r=nagisa
use precalculated dominators in explain_borrow This looks like the only place calculating dominators from the MIR body every time instead of using the ones stored on the `MirBorrowckCtxt`. For example, in #65131 a big generated function with a number of borrowck errors takes a few hours(!) recalculating the dominators while explaining the errors. I don't know enough about this part of rustc codebase to know for sure that this change is correct, but no tests seem to fail as a result of this change in local testing.
2 parents bfc5878 + 4cc707c commit 53aca55

File tree

1 file changed

+1
-1
lines changed
  • src/librustc_mir/borrow_check/nll/explain_borrow

1 file changed

+1
-1
lines changed

src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
458458
/// True if an edge `source -> target` is a backedge -- in other words, if the target
459459
/// dominates the source.
460460
fn is_back_edge(&self, source: Location, target: Location) -> bool {
461-
target.dominates(source, &self.body.dominators())
461+
target.dominates(source, &self.dominators)
462462
}
463463

464464
/// Determine how the borrow was later used.

0 commit comments

Comments
 (0)