summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/capture-mut-ref.rs
blob: 56e01f7b7764bc793d783d2a6b7ec67176e9b4fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// run-rustfix

// Check that capturing a mutable reference by move and assigning to its
// referent doesn't make the unused mut lint think that it is mutable.

#![deny(unused_mut)]

pub fn mutable_upvar() {
    let mut x = &mut 0;
    //~^ ERROR
    let _ = move || {
        *x = 1;
    };
}

fn main() {}