Skip to content

Commit 8d6cf3a

Browse files
committed
Auto merge of #6018 - ebroto:rustup, r=ebroto
Rustup r? `@ghost` changelog: none
2 parents daad592 + e83190b commit 8d6cf3a

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

clippy_lints/src/redundant_clone.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use rustc_middle::mir::{
1414
visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor as _},
1515
};
1616
use rustc_middle::ty::{self, fold::TypeVisitor, Ty};
17-
use rustc_mir::dataflow::BottomValue;
1817
use rustc_mir::dataflow::{Analysis, AnalysisDomain, GenKill, GenKillAnalysis, ResultsCursor};
1918
use rustc_session::{declare_lint_pass, declare_tool_lint};
2019
use rustc_span::source_map::{BytePos, Span};
@@ -411,21 +410,24 @@ impl<'tcx> mir::visit::Visitor<'tcx> for LocalUseVisitor {
411410
struct MaybeStorageLive;
412411

413412
impl<'tcx> AnalysisDomain<'tcx> for MaybeStorageLive {
414-
type Idx = mir::Local;
413+
type Domain = BitSet<mir::Local>;
415414
const NAME: &'static str = "maybe_storage_live";
416415

417-
fn bits_per_block(&self, body: &mir::Body<'tcx>) -> usize {
418-
body.local_decls.len()
416+
fn bottom_value(&self, body: &mir::Body<'tcx>) -> Self::Domain {
417+
// bottom = dead
418+
BitSet::new_empty(body.local_decls.len())
419419
}
420420

421-
fn initialize_start_block(&self, body: &mir::Body<'tcx>, state: &mut BitSet<Self::Idx>) {
421+
fn initialize_start_block(&self, body: &mir::Body<'tcx>, state: &mut Self::Domain) {
422422
for arg in body.args_iter() {
423423
state.insert(arg);
424424
}
425425
}
426426
}
427427

428428
impl<'tcx> GenKillAnalysis<'tcx> for MaybeStorageLive {
429+
type Idx = mir::Local;
430+
429431
fn statement_effect(&self, trans: &mut impl GenKill<Self::Idx>, stmt: &mir::Statement<'tcx>, _: mir::Location) {
430432
match stmt.kind {
431433
mir::StatementKind::StorageLive(l) => trans.gen(l),
@@ -454,11 +456,6 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeStorageLive {
454456
}
455457
}
456458

457-
impl BottomValue for MaybeStorageLive {
458-
/// bottom = dead
459-
const BOTTOM_VALUE: bool = false;
460-
}
461-
462459
/// Collects the possible borrowers of each local.
463460
/// For example, `b = &a; c = &a;` will make `b` and (transitively) `c`
464461
/// possible borrowers of `a`.

0 commit comments

Comments
 (0)