about summary refs log tree commit diff
diff options
context:
space:
mode:
authoribraheemdev <ibrah1440@gmail.com>2021-07-27 12:12:59 -0400
committeribraheemdev <ibrah1440@gmail.com>2021-07-27 12:12:59 -0400
commitdf5e5168d862e5d5d013f53f9c569c7b5514dd8c (patch)
tree2a7058a2abe675b14b3d7df806c3c97b645eac9a
parent880e69154217e0014ed866ddaa1d7a7e9a451b64 (diff)
downloadrust-df5e5168d862e5d5d013f53f9c569c7b5514dd8c.tar.gz
rust-df5e5168d862e5d5d013f53f9c569c7b5514dd8c.zip
remove allow(unconditional_recursion)
-rw-r--r--src/test/ui/nll/issue-51191.rs4
-rw-r--r--src/test/ui/nll/issue-51191.stderr14
2 files changed, 15 insertions, 3 deletions
diff --git a/src/test/ui/nll/issue-51191.rs b/src/test/ui/nll/issue-51191.rs
index 638b9b0b63a..836587d93b8 100644
--- a/src/test/ui/nll/issue-51191.rs
+++ b/src/test/ui/nll/issue-51191.rs
@@ -1,9 +1,9 @@
-#![allow(unconditional_recursion)]
-
 struct Struct;
 
 impl Struct {
     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();
         //~^ ERROR cannot borrow `self` as mutable, as it is not declared as mutable [E0596]
         //~^^ HELP try removing `&mut` here
diff --git a/src/test/ui/nll/issue-51191.stderr b/src/test/ui/nll/issue-51191.stderr
index f2cc78f4b9e..450993425e2 100644
--- a/src/test/ui/nll/issue-51191.stderr
+++ b/src/test/ui/nll/issue-51191.stderr
@@ -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
   --> $DIR/issue-51191.rs:7:9
    |
@@ -36,6 +48,6 @@ LL |         (&mut self).bar();
    |         cannot borrow as mutable
    |         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`.