2015-11-09 21:58:52 -06:00
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
struct S;
|
|
|
|
|
|
|
|
impl S {
|
|
|
|
fn mutate(&mut self) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn func(arg: S) {
|
2019-04-22 02:40:08 -05:00
|
|
|
//~^ HELP consider changing this to be mutable
|
2023-01-01 02:06:31 -06:00
|
|
|
//~| SUGGESTION mut
|
2016-05-12 18:39:09 -05:00
|
|
|
arg.mutate();
|
2019-04-22 02:40:08 -05:00
|
|
|
//~^ ERROR cannot borrow `arg` as mutable, as it is not declared as mutable
|
2015-11-09 21:58:52 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let local = S;
|
2019-04-22 02:40:08 -05:00
|
|
|
//~^ HELP consider changing this to be mutable
|
2023-01-01 02:06:31 -06:00
|
|
|
//~| SUGGESTION mut
|
2016-05-12 18:39:09 -05:00
|
|
|
local.mutate();
|
2019-04-22 02:40:08 -05:00
|
|
|
//~^ ERROR cannot borrow `local` as mutable, as it is not declared as mutable
|
2015-11-09 21:58:52 -06:00
|
|
|
}
|