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.
This commit is contained in:
Cameron Zwarich 2014-06-16 15:40:20 -07:00
parent ba203c5c5d
commit 702ef1b721

View File

@ -684,11 +684,9 @@ impl<'a> CheckLoanCtxt<'a> {
// and aliasing restrictions:
if assignee_cmt.mutbl.is_mutable() {
if check_for_aliasable_mutable_writes(self, assignment_span, assignee_cmt.clone()) {
if mode != euv::Init &&
if mode != euv::Init {
check_for_assignment_to_restricted_or_frozen_location(
self, assignment_id, assignment_span, assignee_cmt.clone())
{
// Safe, but record for lint pass later:
self, assignment_id, assignment_span, assignee_cmt.clone());
mark_variable_as_used_mut(self, assignee_cmt);
}
}