diff options
Diffstat (limited to 'tests/ui/mut/mut-suggestion.rs')
-rw-r--r-- | tests/ui/mut/mut-suggestion.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/mut/mut-suggestion.rs b/tests/ui/mut/mut-suggestion.rs new file mode 100644 index 000000000..8c269d1e7 --- /dev/null +++ b/tests/ui/mut/mut-suggestion.rs @@ -0,0 +1,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 +} |