]> git.proxmox.com Git - rustc.git/blob - src/test/ui/mut/mut-suggestion.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / mut / mut-suggestion.rs
1 #[derive(Copy, Clone)]
2 struct S;
3
4 impl S {
5 fn mutate(&mut self) {
6 }
7 }
8
9 fn func(arg: S) {
10 //~^ HELP consider changing this to be mutable
11 //~| SUGGESTION mut arg
12 arg.mutate();
13 //~^ ERROR cannot borrow `arg` as mutable, as it is not declared as mutable
14 }
15
16 fn main() {
17 let local = S;
18 //~^ HELP consider changing this to be mutable
19 //~| SUGGESTION mut local
20 local.mutate();
21 //~^ ERROR cannot borrow `local` as mutable, as it is not declared as mutable
22 }