Skip to content

Commit

Permalink
Auto merge of #65172 - tanriol:explain_borrow-use-context-dominators,…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
bors committed Oct 16, 2019
2 parents bfc5878 + 4cc707c commit 53aca55
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
/// True if an edge `source -> target` is a backedge -- in other words, if the target
/// dominates the source.
fn is_back_edge(&self, source: Location, target: Location) -> bool {
target.dominates(source, &self.body.dominators())
target.dominates(source, &self.dominators)
}

/// Determine how the borrow was later used.
Expand Down

0 comments on commit 53aca55

Please sign in to comment.