about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDenis Lisov <dennis.lissov@gmail.com>2019-10-07 00:29:47 +0300
committerGitHub <noreply@github.com>2019-10-07 00:29:47 +0300
commit4cc707cb7846c2a136daa42ea3498c5a92903189 (patch)
tree33f23ff19fbb8e0dc553463657a0feee744bed78
parent421bd77f42c2fe8a2596dbcc1580ec97fb89009f (diff)
downloadrust-4cc707cb7846c2a136daa42ea3498c5a92903189.tar.gz
rust-4cc707cb7846c2a136daa42ea3498c5a92903189.zip
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 rust-lang/rust#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.
-rw-r--r--src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
index ff4243df6e9..e6a33f8e6ad 100644
--- a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
@@ -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.