@@ -23,7 +23,7 @@ use rustc_errors::{Diagnostic, DiagnosticBuilder, DiagnosticMessage, Subdiagnost
23
23
use rustc_fluent_macro:: fluent_messages;
24
24
use rustc_hir as hir;
25
25
use rustc_hir:: def_id:: LocalDefId ;
26
- use rustc_index:: bit_set:: { BitSet , ChunkedBitSet } ;
26
+ use rustc_index:: bit_set:: ChunkedBitSet ;
27
27
use rustc_index:: { IndexSlice , IndexVec } ;
28
28
use rustc_infer:: infer:: {
29
29
InferCtxt , NllRegionVariableOrigin , RegionVariableOrigin , TyCtxtInferExt ,
@@ -42,6 +42,7 @@ use rustc_session::lint::builtin::UNUSED_MUT;
42
42
use rustc_span:: { Span , Symbol } ;
43
43
use rustc_target:: abi:: FieldIdx ;
44
44
45
+ use either:: Either ;
45
46
use smallvec:: SmallVec ;
46
47
use std:: cell:: RefCell ;
47
48
use std:: collections:: BTreeMap ;
@@ -1034,16 +1035,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1034
1035
let borrow_set = self . borrow_set . clone ( ) ;
1035
1036
1036
1037
// Use polonius output if it has been enabled.
1037
- let mut polonius_output;
1038
- let borrows_in_scope = if let Some ( polonius) = & self . polonius_output {
1038
+ let polonius_output = self . polonius_output . clone ( ) ;
1039
+ let borrows_in_scope = if let Some ( polonius) = & polonius_output {
1039
1040
let location = self . location_table . start_index ( location) ;
1040
- polonius_output = BitSet :: new_empty ( borrow_set. len ( ) ) ;
1041
- for & idx in polonius. errors_at ( location) {
1042
- polonius_output. insert ( idx) ;
1043
- }
1044
- & polonius_output
1041
+ Either :: Left ( polonius. errors_at ( location) . iter ( ) . copied ( ) )
1045
1042
} else {
1046
- & flow_state. borrows
1043
+ Either :: Right ( flow_state. borrows . iter ( ) )
1047
1044
} ;
1048
1045
1049
1046
each_borrow_involving_path (
@@ -1053,7 +1050,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1053
1050
location,
1054
1051
( sd, place_span. 0 ) ,
1055
1052
& borrow_set,
1056
- |borrow_index| borrows_in_scope. contains ( borrow_index ) ,
1053
+ borrows_in_scope,
1057
1054
|this, borrow_index, borrow| match ( rw, borrow. kind ) {
1058
1055
// Obviously an activation is compatible with its own
1059
1056
// reservation (or even prior activating uses of same
0 commit comments