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