Skip to content

Commit

Permalink
Fix upvars sometimes not being marked as used mutably
Browse files Browse the repository at this point in the history
Drill down the loan path for McDeclared references as well since
it might lead to an upvar.  Closes #18769
  • Loading branch information
bkoropoff committed Nov 9, 2014
1 parent 93c85eb commit fb4e618
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librustc/middle/borrowck/gather_loans/mod.rs
Expand Up @@ -395,10 +395,10 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
LpUpvar(ty::UpvarId{ var_id: local_id, closure_expr_id: _ }) => {
self.tcx().used_mut_nodes.borrow_mut().insert(local_id);
}
LpExtend(ref base, mc::McInherited, _) => {
LpExtend(ref base, mc::McInherited, _) |
LpExtend(ref base, mc::McDeclared, _) => {
self.mark_loan_path_as_mutated(&**base);
}
LpExtend(_, mc::McDeclared, _) |
LpExtend(_, mc::McImmutable, _) => {
// Nothing to do.
}
Expand Down

0 comments on commit fb4e618

Please sign in to comment.