Skip to content

Commit 99e0fc2

Browse files
committed
tmp: use polonius loan scopes to see how terribly slow it is
1 parent 0f2156c commit 99e0fc2

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

compiler/rustc_borrowck/src/dataflow.rs

+6-14
Original file line numberDiff line numberDiff line change
@@ -403,13 +403,10 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
403403
regioncx: &'a RegionInferenceContext<'tcx>,
404404
borrow_set: &'a BorrowSet<'tcx>,
405405
) -> Self {
406-
let mut borrows_out_of_scope_at_location =
407-
calculate_borrows_out_of_scope_at_location(body, regioncx, borrow_set);
408-
409-
// The in-tree polonius analysis computes loans going out of scope using the set-of-loans
410-
// model, and makes sure they're identical to the existing computation of the set-of-points
411-
// model.
412-
if tcx.sess.opts.unstable_opts.polonius.is_next_enabled() {
406+
let borrows_out_of_scope_at_location = {
407+
// The in-tree polonius analysis computes loans going out of scope using the set-of-loans
408+
// model, and makes sure they're identical to the existing computation of the set-of-points
409+
// model.
413410
let mut polonius_prec = PoloniusOutOfScopePrecomputer::new(body, regioncx);
414411
for (loan_idx, loan_data) in borrow_set.iter_enumerated() {
415412
let issuing_region = loan_data.region;
@@ -422,13 +419,8 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
422419
);
423420
}
424421

425-
assert_eq!(
426-
borrows_out_of_scope_at_location, polonius_prec.loans_out_of_scope_at_location,
427-
"the loans out of scope must be the same as the borrows out of scope"
428-
);
429-
430-
borrows_out_of_scope_at_location = polonius_prec.loans_out_of_scope_at_location;
431-
}
422+
polonius_prec.loans_out_of_scope_at_location
423+
};
432424

433425
Borrows { tcx, body, borrow_set, borrows_out_of_scope_at_location }
434426
}

0 commit comments

Comments
 (0)