Skip to content

Commit

Permalink
librustc: Properly tag upvars in proc's to stop misleading unused_mut…
Browse files Browse the repository at this point in the history
… warnings.
  • Loading branch information
luqmana committed Aug 22, 2014
1 parent 36789fb commit 30ab05a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/librustc/middle/borrowck/gather_loans/restrictions.rs
Expand Up @@ -70,18 +70,19 @@ impl<'a> RestrictionsContext<'a> {
mc::cat_arg(local_id) => {
// R-Variable, locally declared
let lp = Rc::new(LpVar(local_id));
SafeIf(lp.clone(), vec!(lp))
SafeIf(lp.clone(), vec![lp])
}

mc::cat_upvar(upvar_id, _) => {
// R-Variable, captured into closure
let lp = Rc::new(LpUpvar(upvar_id));
SafeIf(lp.clone(), vec!(lp))
SafeIf(lp.clone(), vec![lp])
}

mc::cat_copied_upvar(..) => {
// FIXME(#2152) allow mutation of upvars
Safe
mc::cat_copied_upvar(mc::CopiedUpvar { upvar_id, .. }) => {
// R-Variable, copied/moved into closure
let lp = Rc::new(LpVar(upvar_id));
SafeIf(lp.clone(), vec![lp])
}

mc::cat_downcast(cmt_base) => {
Expand Down

0 comments on commit 30ab05a

Please sign in to comment.