summaryrefslogtreecommitdiffstats
path: root/tests/ui/mut/mut-suggestion.rs
blob: 8c269d1e727643e96a43a28f115014bfa30a1c00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#[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
}