Skip to content

Commit 30ab05a

Browse files
committed
librustc: Properly tag upvars in proc's to stop misleading unused_mut warnings.
1 parent 36789fb commit 30ab05a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/librustc/middle/borrowck/gather_loans/restrictions.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,19 @@ impl<'a> RestrictionsContext<'a> {
7070
mc::cat_arg(local_id) => {
7171
// R-Variable, locally declared
7272
let lp = Rc::new(LpVar(local_id));
73-
SafeIf(lp.clone(), vec!(lp))
73+
SafeIf(lp.clone(), vec![lp])
7474
}
7575

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

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

8788
mc::cat_downcast(cmt_base) => {

0 commit comments

Comments
 (0)