]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/capture-mut-ref.rs
Rollup merge of #60685 - dtolnay:spdx, r=nikomatsakis
[rust.git] / src / test / ui / nll / capture-mut-ref.rs
1 // Check that capturing a mutable reference by move and assigning to its
2 // referent doesn't make the unused mut lint think that it is mutable.
3
4 #![feature(nll)]
5 #![deny(unused_mut)]
6
7 fn mutable_upvar() {
8     let mut x = &mut 0;
9     //~^ ERROR
10     move || {
11         *x = 1;
12     };
13 }
14
15 fn main() {}