Skip to content

Commit 757e944

Browse files
committed
Adjust old code for newer rustc version.
1 parent 5eed9c6 commit 757e944

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clippy_utils/src/mir/possible_borrower.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use rustc_lint::LateContext;
66
use rustc_middle::mir::{self, visit::Visitor as _, Mutability};
77
use rustc_middle::ty::{self, visit::TypeVisitor};
88
use rustc_mir_dataflow::{impls::MaybeStorageLive, Analysis, ResultsCursor};
9+
use std::borrow::Cow;
910
use 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)) {
167168
pub 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

Comments
 (0)