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