remove allow(unconditional_recursion)
This commit is contained in:
parent
880e691542
commit
df5e5168d8
2 changed files with 15 additions and 3 deletions
|
@ -1,9 +1,9 @@
|
||||||
#![allow(unconditional_recursion)]
|
|
||||||
|
|
||||||
struct Struct;
|
struct Struct;
|
||||||
|
|
||||||
impl Struct {
|
impl Struct {
|
||||||
fn bar(self: &mut Self) {
|
fn bar(self: &mut Self) {
|
||||||
|
//~^ WARN function cannot return without recursing
|
||||||
|
//~^^ HELP a `loop` may express intention better if this is on purpose
|
||||||
(&mut self).bar();
|
(&mut self).bar();
|
||||||
//~^ ERROR cannot borrow `self` as mutable, as it is not declared as mutable [E0596]
|
//~^ ERROR cannot borrow `self` as mutable, as it is not declared as mutable [E0596]
|
||||||
//~^^ HELP try removing `&mut` here
|
//~^^ HELP try removing `&mut` here
|
||||||
|
|
|
@ -1,3 +1,15 @@
|
||||||
|
warning: function cannot return without recursing
|
||||||
|
--> $DIR/issue-51191.rs:4:5
|
||||||
|
|
|
||||||
|
LL | fn bar(self: &mut Self) {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
|
||||||
|
...
|
||||||
|
LL | (&mut self).bar();
|
||||||
|
| ----------------- recursive call site
|
||||||
|
|
|
||||||
|
= note: `#[warn(unconditional_recursion)]` on by default
|
||||||
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
|
error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
|
||||||
--> $DIR/issue-51191.rs:7:9
|
--> $DIR/issue-51191.rs:7:9
|
||||||
|
|
|
|
||||||
|
@ -36,6 +48,6 @@ LL | (&mut self).bar();
|
||||||
| cannot borrow as mutable
|
| cannot borrow as mutable
|
||||||
| help: try removing `&mut` here
|
| help: try removing `&mut` here
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 5 previous errors; 1 warning emitted
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0596`.
|
For more information about this error, try `rustc --explain E0596`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue