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