Skip to content

Commit

Permalink
Move debug statement into statement visitor
Browse files Browse the repository at this point in the history
  • Loading branch information
czipperz committed Jun 2, 2019
1 parent a39fffe commit 0a6a5c8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/librustc_mir/borrow_check/used_muts.rs
Expand Up @@ -60,11 +60,6 @@ impl GatherUsedMutsVisitor<'_, '_, '_, '_> {
// they will either have been removed by unreachable code optimizations; or linted
// as unused variables.
if let Some(local) = into.base_local() {
debug!(
"visit_statement: statement={:?} local={:?} \
never_initialized_mut_locals={:?}",
statement, local, self.never_initialized_mut_locals
);
let _ = self.never_initialized_mut_locals.remove(&local);
}
}
Expand Down Expand Up @@ -95,6 +90,13 @@ impl<'visit, 'cx, 'gcx, 'tcx> Visitor<'tcx> for GatherUsedMutsVisitor<'visit, 'c
) {
match &statement.kind {
StatementKind::Assign(into, _) => {
if let Some(local) = into.base_local() {
debug!(
"visit_statement: statement={:?} local={:?} \
never_initialized_mut_locals={:?}",
statement, local, self.never_initialized_mut_locals
);
}
self.remove_never_initialized_mut_locals(into);
},
_ => {},
Expand Down

0 comments on commit 0a6a5c8

Please sign in to comment.