rust/tests/ui/mut/mut-suggestion.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
483 B
Rust
Raw Normal View History

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