@@ -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:: ChunkedBitSet ;
26
+ use rustc_index:: bit_set:: { BitSet , ChunkedBitSet } ;
27
27
use rustc_index:: { IndexSlice , IndexVec } ;
28
28
use rustc_infer:: infer:: {
29
29
InferCtxt , NllRegionVariableOrigin , RegionVariableOrigin , TyCtxtInferExt ,
@@ -42,7 +42,6 @@ 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 ;
46
45
use smallvec:: SmallVec ;
47
46
use std:: cell:: RefCell ;
48
47
use std:: collections:: BTreeMap ;
@@ -1035,12 +1034,16 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1035
1034
let borrow_set = self . borrow_set . clone ( ) ;
1036
1035
1037
1036
// Use polonius output if it has been enabled.
1038
- let polonius_output = self . polonius_output . clone ( ) ;
1039
- let borrows_in_scope = if let Some ( polonius) = & polonius_output {
1037
+ let mut polonius_output;
1038
+ let borrows_in_scope = if let Some ( polonius) = & self . polonius_output {
1040
1039
let location = self . location_table . start_index ( location) ;
1041
- Either :: Left ( polonius. errors_at ( location) . iter ( ) . copied ( ) )
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
1042
1045
} else {
1043
- Either :: Right ( flow_state. borrows . iter ( ) )
1046
+ & flow_state. borrows
1044
1047
} ;
1045
1048
1046
1049
each_borrow_involving_path (
@@ -1050,7 +1053,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1050
1053
location,
1051
1054
( sd, place_span. 0 ) ,
1052
1055
& borrow_set,
1053
- borrows_in_scope,
1056
+ |borrow_index| borrows_in_scope. contains ( borrow_index ) ,
1054
1057
|this, borrow_index, borrow| match ( rw, borrow. kind ) {
1055
1058
// Obviously an activation is compatible with its own
1056
1059
// reservation (or even prior activating uses of same
0 commit comments