2020-07-02 00:32:12 -05:00
|
|
|
// run-rustfix
|
|
|
|
|
2018-07-03 14:12:09 -05:00
|
|
|
// 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)]
|
|
|
|
|
2020-07-02 00:32:12 -05:00
|
|
|
pub fn mutable_upvar() {
|
2018-07-03 14:12:09 -05:00
|
|
|
let mut x = &mut 0;
|
|
|
|
//~^ ERROR
|
2020-07-27 19:00:00 -05:00
|
|
|
let _ = move || {
|
2018-07-03 14:12:09 -05:00
|
|
|
*x = 1;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|