Skip to content

Commit 04f5d54

Browse files
author
Markus Westerlind
committed
perf: Limit leak check snapshotting to probe_maybe_skip_leak_check
1 parent eb7ed0c commit 04f5d54

File tree

1 file changed

+5
-8
lines changed
  • src/librustc_infer/infer

1 file changed

+5
-8
lines changed

src/librustc_infer/infer/mod.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,6 @@ pub struct CombinedSnapshot<'a, 'tcx> {
918918
region_obligations_snapshot: usize,
919919
universe: ty::UniverseIndex,
920920
was_in_snapshot: bool,
921-
was_skip_leak_check: bool,
922921
_in_progress_tables: Option<Ref<'a, ty::TypeckTables<'tcx>>>,
923922
}
924923

@@ -1056,7 +1055,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
10561055
region_obligations_snapshot: inner.region_obligations.len(),
10571056
universe: self.universe(),
10581057
was_in_snapshot: in_snapshot,
1059-
was_skip_leak_check: self.skip_leak_check.get(),
10601058
// Borrow tables "in progress" (i.e., during typeck)
10611059
// to ban writes from within a snapshot to them.
10621060
_in_progress_tables: self.in_progress_tables.map(|tables| tables.borrow()),
@@ -1070,13 +1068,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
10701068
region_obligations_snapshot,
10711069
universe,
10721070
was_in_snapshot,
1073-
was_skip_leak_check,
10741071
_in_progress_tables,
10751072
} = snapshot;
10761073

10771074
self.in_snapshot.set(was_in_snapshot);
10781075
self.universe.set(universe);
1079-
self.skip_leak_check.set(was_skip_leak_check);
10801076

10811077
let InferCtxtInner {
10821078
type_variables,
@@ -1110,12 +1106,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11101106
region_obligations_snapshot: _,
11111107
universe: _,
11121108
was_in_snapshot,
1113-
was_skip_leak_check,
11141109
_in_progress_tables,
11151110
} = snapshot;
11161111

11171112
self.in_snapshot.set(was_in_snapshot);
1118-
self.skip_leak_check.set(was_skip_leak_check);
11191113

11201114
let mut inner = self.inner.borrow_mut();
11211115
inner.undo_log.commit(undo_snapshot);
@@ -1183,10 +1177,13 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11831177
{
11841178
debug!("probe()");
11851179
let snapshot = self.start_snapshot();
1186-
let skip_leak_check = should_skip || self.skip_leak_check.get();
1187-
self.skip_leak_check.set(skip_leak_check);
1180+
let was_skip_leak_check = self.skip_leak_check.get();
1181+
if should_skip {
1182+
self.skip_leak_check.set(true);
1183+
}
11881184
let r = f(&snapshot);
11891185
self.rollback_to("probe", snapshot);
1186+
self.skip_leak_check.set(was_skip_leak_check);
11901187
r
11911188
}
11921189

0 commit comments

Comments
 (0)