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-10 03:58:52 +00: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 08:06:31 +00:00
//~| SUGGESTION mut
2016-05-12 23:39:09 +00:00
arg.mutate();
//~^ ERROR cannot borrow `arg` as mutable, as it is not declared as mutable
2015-11-10 03:58:52 +00:00
}
fn main() {
let local = S;
//~^ HELP consider changing this to be mutable
2023-01-01 08:06:31 +00:00
//~| SUGGESTION mut
2016-05-12 23:39:09 +00:00
local.mutate();
//~^ ERROR cannot borrow `local` as mutable, as it is not declared as mutable
2015-11-10 03:58:52 +00:00
}