about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarkus Westerlind <markus.westerlind@distilnetworks.com>2020-02-25 14:31:07 +0100
committerMarkus Westerlind <markus.westerlind@distilnetworks.com>2020-05-05 11:24:36 +0200
commit04f5d54d132d8469acf888e5ad6e39748ab53a1f (patch)
tree54791b1baa24848e1c7a32cf090428955c1ab90b
parenteb7ed0c917310592a05c5e2257986c6ba13d18b6 (diff)
downloadrust-04f5d54d132d8469acf888e5ad6e39748ab53a1f.tar.gz
rust-04f5d54d132d8469acf888e5ad6e39748ab53a1f.zip
perf: Limit leak check snapshotting to probe_maybe_skip_leak_check
-rw-r--r--src/librustc_infer/infer/mod.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/librustc_infer/infer/mod.rs b/src/librustc_infer/infer/mod.rs
index fbba96fbe99..df8119bfa54 100644
--- a/src/librustc_infer/infer/mod.rs
+++ b/src/librustc_infer/infer/mod.rs
@@ -918,7 +918,6 @@ pub struct CombinedSnapshot<'a, 'tcx> {
     region_obligations_snapshot: usize,
     universe: ty::UniverseIndex,
     was_in_snapshot: bool,
-    was_skip_leak_check: bool,
     _in_progress_tables: Option<Ref<'a, ty::TypeckTables<'tcx>>>,
 }
 
@@ -1056,7 +1055,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             region_obligations_snapshot: inner.region_obligations.len(),
             universe: self.universe(),
             was_in_snapshot: in_snapshot,
-            was_skip_leak_check: self.skip_leak_check.get(),
             // Borrow tables "in progress" (i.e., during typeck)
             // to ban writes from within a snapshot to them.
             _in_progress_tables: self.in_progress_tables.map(|tables| tables.borrow()),
@@ -1070,13 +1068,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             region_obligations_snapshot,
             universe,
             was_in_snapshot,
-            was_skip_leak_check,
             _in_progress_tables,
         } = snapshot;
 
         self.in_snapshot.set(was_in_snapshot);
         self.universe.set(universe);
-        self.skip_leak_check.set(was_skip_leak_check);
 
         let InferCtxtInner {
             type_variables,
@@ -1110,12 +1106,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             region_obligations_snapshot: _,
             universe: _,
             was_in_snapshot,
-            was_skip_leak_check,
             _in_progress_tables,
         } = snapshot;
 
         self.in_snapshot.set(was_in_snapshot);
-        self.skip_leak_check.set(was_skip_leak_check);
 
         let mut inner = self.inner.borrow_mut();
         inner.undo_log.commit(undo_snapshot);
@@ -1183,10 +1177,13 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
     {
         debug!("probe()");
         let snapshot = self.start_snapshot();
-        let skip_leak_check = should_skip || self.skip_leak_check.get();
-        self.skip_leak_check.set(skip_leak_check);
+        let was_skip_leak_check = self.skip_leak_check.get();
+        if should_skip {
+            self.skip_leak_check.set(true);
+        }
         let r = f(&snapshot);
         self.rollback_to("probe", snapshot);
+        self.skip_leak_check.set(was_skip_leak_check);
         r
     }