@@ -6,6 +6,7 @@ use rustc_lint::LateContext;
66use rustc_middle:: mir:: { self , visit:: Visitor as _, Mutability } ;
77use rustc_middle:: ty:: { self , visit:: TypeVisitor } ;
88use rustc_mir_dataflow:: { impls:: MaybeStorageLive , Analysis , ResultsCursor } ;
9+ use std:: borrow:: Cow ;
910use std:: ops:: ControlFlow ;
1011
1112/// Collects the possible borrowers of each local.
@@ -36,7 +37,7 @@ impl<'a, 'b, 'tcx> PossibleBorrowerVisitor<'a, 'b, 'tcx> {
3637 fn into_map (
3738 self ,
3839 cx : & ' a LateContext < ' tcx > ,
39- maybe_live : ResultsCursor < ' b , ' tcx , MaybeStorageLive > ,
40+ maybe_live : ResultsCursor < ' b , ' tcx , MaybeStorageLive < ' tcx > > ,
4041 ) -> PossibleBorrowerMap < ' b , ' tcx > {
4142 let mut map = FxHashMap :: default ( ) ;
4243 for row in ( 1 ..self . body . local_decls . len ( ) ) . map ( mir:: Local :: from_usize) {
@@ -167,7 +168,7 @@ fn rvalue_locals(rvalue: &mir::Rvalue<'_>, mut visit: impl FnMut(mir::Local)) {
167168pub struct PossibleBorrowerMap < ' b , ' tcx > {
168169 /// Mapping `Local -> its possible borrowers`
169170 pub map : FxHashMap < mir:: Local , HybridBitSet < mir:: Local > > ,
170- maybe_live : ResultsCursor < ' b , ' tcx , MaybeStorageLive > ,
171+ maybe_live : ResultsCursor < ' b , ' tcx , MaybeStorageLive < ' tcx > > ,
171172 // Caches to avoid allocation of `BitSet` on every query
172173 pub bitset : ( BitSet < mir:: Local > , BitSet < mir:: Local > ) ,
173174}
@@ -179,7 +180,7 @@ impl<'a, 'b, 'tcx> PossibleBorrowerMap<'b, 'tcx> {
179180 vis. visit_body ( mir) ;
180181 vis. into_map ( cx)
181182 } ;
182- let maybe_storage_live_result = MaybeStorageLive :: new ( BitSet :: new_empty ( mir. local_decls . len ( ) ) )
183+ let maybe_storage_live_result = MaybeStorageLive :: new ( Cow :: Owned ( BitSet :: new_empty ( mir. local_decls . len ( ) ) ) )
183184 . into_engine ( cx. tcx , mir)
184185 . pass_name ( "redundant_clone" )
185186 . iterate_to_fixpoint ( )
0 commit comments