@@ -23,7 +23,7 @@ use rustc_errors::{Diagnostic, DiagnosticBuilder, DiagnosticMessage, Subdiagnost
2323use rustc_fluent_macro:: fluent_messages;
2424use rustc_hir as hir;
2525use rustc_hir:: def_id:: LocalDefId ;
26- use rustc_index:: bit_set:: ChunkedBitSet ;
26+ use rustc_index:: bit_set:: { BitSet , ChunkedBitSet } ;
2727use rustc_index:: { IndexSlice , IndexVec } ;
2828use rustc_infer:: infer:: {
2929 InferCtxt , NllRegionVariableOrigin , RegionVariableOrigin , TyCtxtInferExt ,
@@ -42,7 +42,6 @@ use rustc_session::lint::builtin::UNUSED_MUT;
4242use rustc_span:: { Span , Symbol } ;
4343use rustc_target:: abi:: FieldIdx ;
4444
45- use either:: Either ;
4645use smallvec:: SmallVec ;
4746use std:: cell:: RefCell ;
4847use std:: collections:: BTreeMap ;
@@ -1035,12 +1034,16 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10351034 let borrow_set = self . borrow_set . clone ( ) ;
10361035
10371036 // 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 {
10401039 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
10421045 } else {
1043- Either :: Right ( flow_state. borrows . iter ( ) )
1046+ & flow_state. borrows
10441047 } ;
10451048
10461049 each_borrow_involving_path (
@@ -1050,7 +1053,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10501053 location,
10511054 ( sd, place_span. 0 ) ,
10521055 & borrow_set,
1053- borrows_in_scope,
1056+ |borrow_index| borrows_in_scope. contains ( borrow_index ) ,
10541057 |this, borrow_index, borrow| match ( rw, borrow. kind ) {
10551058 // Obviously an activation is compatible with its own
10561059 // reservation (or even prior activating uses of same
0 commit comments