Skip to content

Commit 702ef1b

Browse files
author
Cameron Zwarich
committed
Call mark_variable_as_used_mut even after assignment errors
It doesn't actually matter if we call mark_variable_as_used_mut when the assignment was invalid, since the variable was still used mutably.
1 parent ba203c5 commit 702ef1b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/librustc/middle/borrowck/check_loans.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,11 +684,9 @@ impl<'a> CheckLoanCtxt<'a> {
684684
// and aliasing restrictions:
685685
if assignee_cmt.mutbl.is_mutable() {
686686
if check_for_aliasable_mutable_writes(self, assignment_span, assignee_cmt.clone()) {
687-
if mode != euv::Init &&
687+
if mode != euv::Init {
688688
check_for_assignment_to_restricted_or_frozen_location(
689-
self, assignment_id, assignment_span, assignee_cmt.clone())
690-
{
691-
// Safe, but record for lint pass later:
689+
self, assignment_id, assignment_span, assignee_cmt.clone());
692690
mark_variable_as_used_mut(self, assignee_cmt);
693691
}
694692
}

0 commit comments

Comments
 (0)