]> git.lizzy.rs Git - rust.git/blob - tests/ui/did_you_mean/issue-31424.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / did_you_mean / issue-31424.rs
1 // forbid-output: &mut mut self
2
3 struct Struct;
4
5 impl Struct {
6     fn foo(&mut self) {
7         (&mut self).bar(); //~ ERROR cannot borrow
8         //~^ HELP try removing `&mut` here
9     }
10
11     // In this case we could keep the suggestion, but to distinguish the
12     // two cases is pretty hard. It's an obscure case anyway.
13     fn bar(self: &mut Self) {
14         //~^ WARN function cannot return without recursing
15         //~^^ HELP a `loop` may express intention better if this is on purpose
16         (&mut self).bar(); //~ ERROR cannot borrow
17         //~^ HELP try removing `&mut` here
18     }
19 }
20
21 fn main () {}