mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
16 lines
308 B
Rust
16 lines
308 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 mut x = &mut 0;
|
|
//~^ ERROR
|
|
let _ = move || {
|
|
*x = 1;
|
|
};
|
|
}
|
|
|
|
fn main() {}
|