File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Top Open diff view settings Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Top Open diff view settings Original file line number Diff line number Diff line change 1- #![ allow( unconditional_recursion) ]
2-
31struct Struct ;
42
53impl Struct {
64 fn bar ( self : & mut Self ) {
5+ //~^ WARN function cannot return without recursing
6+ //~^^ HELP a `loop` may express intention better if this is on purpose
77 ( & mut self ) . bar ( ) ;
88 //~^ ERROR cannot borrow `self` as mutable, as it is not declared as mutable [E0596]
99 //~^^ HELP try removing `&mut` here
Original file line number Diff line number Diff line change 1+ warning: function cannot return without recursing
2+ --> $DIR/issue-51191.rs:4:5
3+ |
4+ LL | fn bar(self: &mut Self) {
5+ | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
6+ ...
7+ LL | (&mut self).bar();
8+ | ----------------- recursive call site
9+ |
10+ = note: `#[warn(unconditional_recursion)]` on by default
11+ = help: a `loop` may express intention better if this is on purpose
12+
113error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
214 --> $DIR/issue-51191.rs:7:9
315 |
@@ -36,6 +48,6 @@ LL | (&mut self).bar();
3648 | cannot borrow as mutable
3749 | help: try removing `&mut` here
3850
39- error: aborting due to 5 previous errors
51+ error: aborting due to 5 previous errors; 1 warning emitted
4052
4153For more information about this error, try `rustc --explain E0596`.
You can’t perform that action at this time.
0 commit comments