mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
23 lines
483 B
Rust
23 lines
483 B
Rust
#[derive(Copy, Clone)]
|
|
struct S;
|
|
|
|
impl S {
|
|
fn mutate(&mut self) {
|
|
}
|
|
}
|
|
|
|
fn func(arg: S) {
|
|
//~^ HELP consider changing this to be mutable
|
|
//~| SUGGESTION mut
|
|
arg.mutate();
|
|
//~^ ERROR cannot borrow `arg` as mutable, as it is not declared as mutable
|
|
}
|
|
|
|
fn main() {
|
|
let local = S;
|
|
//~^ HELP consider changing this to be mutable
|
|
//~| SUGGESTION mut
|
|
local.mutate();
|
|
//~^ ERROR cannot borrow `local` as mutable, as it is not declared as mutable
|
|
}
|