Skip to content

Commit

Permalink
use precalculated dominators in explain_borrow
Browse files Browse the repository at this point in the history
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
tanriol committed Oct 6, 2019
1 parent 421bd77 commit 4cc707c
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 @@ -457,7 +457,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 4cc707c

Please sign in to comment.