rust/tests/ui/nll/capture-mut-ref.fixed
2023-01-11 09:32:08 +00:00

17 lines
304 B
Rust

// 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 x = &mut 0;
//~^ ERROR
let _ = move || {
*x = 1;
};
}
fn main() {}