diff options
| author | bors <bors@rust-lang.org> | 2018-10-25 20:40:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-10-25 20:40:31 +0000 |
| commit | 4bd4e4130ed531a644263db26bf8461704215c77 (patch) | |
| tree | 1ea4c9d52368ab1271659dea4807bc4a7151918a /src/test/ui | |
| parent | 8ec22e7ec7ed0da2add0763d239e77c5474f3d4a (diff) | |
| parent | f81d1dd29401cd586a13b77db729f42076f07902 (diff) | |
| download | rust-4bd4e4130ed531a644263db26bf8461704215c77.tar.gz rust-4bd4e4130ed531a644263db26bf8461704215c77.zip | |
Auto merge of #54490 - wesleywiser:rewrite_it_in_mir, r=oli-obk
Rewrite the `UnconditionalRecursion` lint to use MIR Part of #51002 r? @eddyb
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/did_you_mean/issue-31424.nll.stderr | 14 | ||||
| -rw-r--r-- | src/test/ui/did_you_mean/issue-31424.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/did_you_mean/issue-31424.stderr | 14 | ||||
| -rw-r--r-- | src/test/ui/nll/issue-51191.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/nll/issue-51191.stderr | 22 | ||||
| -rw-r--r-- | src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr | 14 | ||||
| -rw-r--r-- | src/test/ui/regions/region-bound-on-closure-outlives-call.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/regions/region-bound-on-closure-outlives-call.stderr | 14 |
8 files changed, 72 insertions, 9 deletions
diff --git a/src/test/ui/did_you_mean/issue-31424.nll.stderr b/src/test/ui/did_you_mean/issue-31424.nll.stderr index 15139e4e8ae..fca29c9a9f6 100644 --- a/src/test/ui/did_you_mean/issue-31424.nll.stderr +++ b/src/test/ui/did_you_mean/issue-31424.nll.stderr @@ -7,8 +7,20 @@ LL | (&mut self).bar(); //~ ERROR cannot borrow | cannot borrow as mutable | try removing `&mut` here +warning: function cannot return without recursing + --> $DIR/issue-31424.rs:22:5 + | +LL | fn bar(self: &mut Self) { + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing +LL | //~^ WARN function cannot return without recursing +LL | (&mut self).bar(); //~ ERROR cannot borrow + | ----------------- 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-31424.rs:23:9 + --> $DIR/issue-31424.rs:24:9 | LL | (&mut self).bar(); //~ ERROR cannot borrow | ^^^^^^^^^^^ diff --git a/src/test/ui/did_you_mean/issue-31424.rs b/src/test/ui/did_you_mean/issue-31424.rs index 1b31e064337..903a76a8243 100644 --- a/src/test/ui/did_you_mean/issue-31424.rs +++ b/src/test/ui/did_you_mean/issue-31424.rs @@ -20,6 +20,7 @@ impl Struct { // In this case we could keep the suggestion, but to distinguish the // two cases is pretty hard. It's an obscure case anyway. fn bar(self: &mut Self) { + //~^ WARN function cannot return without recursing (&mut self).bar(); //~ ERROR cannot borrow } } diff --git a/src/test/ui/did_you_mean/issue-31424.stderr b/src/test/ui/did_you_mean/issue-31424.stderr index 9d0ab21ffaf..2e4bcc7f959 100644 --- a/src/test/ui/did_you_mean/issue-31424.stderr +++ b/src/test/ui/did_you_mean/issue-31424.stderr @@ -7,8 +7,20 @@ LL | (&mut self).bar(); //~ ERROR cannot borrow | cannot reborrow mutably | try removing `&mut` here +warning: function cannot return without recursing + --> $DIR/issue-31424.rs:22:5 + | +LL | fn bar(self: &mut Self) { + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing +LL | //~^ WARN function cannot return without recursing +LL | (&mut self).bar(); //~ ERROR cannot borrow + | ----------------- 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 immutable argument `self` as mutable - --> $DIR/issue-31424.rs:23:15 + --> $DIR/issue-31424.rs:24:15 | LL | (&mut self).bar(); //~ ERROR cannot borrow | ^^^^ cannot borrow mutably diff --git a/src/test/ui/nll/issue-51191.rs b/src/test/ui/nll/issue-51191.rs index 87ec3e5df0b..0f8372e094d 100644 --- a/src/test/ui/nll/issue-51191.rs +++ b/src/test/ui/nll/issue-51191.rs @@ -14,6 +14,7 @@ struct Struct; impl Struct { fn bar(self: &mut Self) { + //~^ WARN function cannot return without recursing (&mut self).bar(); //~^ ERROR cannot borrow `self` as mutable, as it is not declared as mutable [E0596] } diff --git a/src/test/ui/nll/issue-51191.stderr b/src/test/ui/nll/issue-51191.stderr index c5b5218f173..88c653effb4 100644 --- a/src/test/ui/nll/issue-51191.stderr +++ b/src/test/ui/nll/issue-51191.stderr @@ -1,5 +1,17 @@ +warning: function cannot return without recursing + --> $DIR/issue-51191.rs:16:5 + | +LL | fn bar(self: &mut Self) { + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing +LL | //~^ WARN function 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:17:9 + --> $DIR/issue-51191.rs:18:9 | LL | (&mut self).bar(); | ^^^^^^^^^^^ @@ -8,7 +20,7 @@ LL | (&mut self).bar(); | try removing `&mut` here error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-51191.rs:22:9 + --> $DIR/issue-51191.rs:23:9 | LL | fn imm(self) { | ---- help: consider changing this to be mutable: `mut self` @@ -16,19 +28,19 @@ LL | (&mut self).bar(); | ^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-51191.rs:31:9 + --> $DIR/issue-51191.rs:32:9 | LL | (&mut self).bar(); | ^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/issue-51191.rs:31:9 + --> $DIR/issue-51191.rs:32:9 | LL | (&mut self).bar(); | ^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-51191.rs:37:9 + --> $DIR/issue-51191.rs:38:9 | LL | (&mut self).bar(); | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr b/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr index f11cc77bbea..f94da326883 100644 --- a/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr +++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr @@ -1,5 +1,17 @@ +warning: function cannot return without recursing + --> $DIR/region-bound-on-closure-outlives-call.rs:11:1 + | +LL | fn call_rec<F>(mut f: F) -> usize where F: FnMut(usize) -> usize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing +LL | //~^ WARN function cannot return without recursing +LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` + | ----------- recursive call site + | + = note: #[warn(unconditional_recursion)] on by default + = help: a `loop` may express intention better if this is on purpose + error[E0505]: cannot move out of `f` because it is borrowed - --> $DIR/region-bound-on-closure-outlives-call.rs:12:25 + --> $DIR/region-bound-on-closure-outlives-call.rs:13:25 | LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` | ---------- ^ move out of `f` occurs here diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.rs b/src/test/ui/regions/region-bound-on-closure-outlives-call.rs index b73c283fa51..f931e281c83 100644 --- a/src/test/ui/regions/region-bound-on-closure-outlives-call.rs +++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.rs @@ -9,6 +9,7 @@ // except according to those terms. fn call_rec<F>(mut f: F) -> usize where F: FnMut(usize) -> usize { + //~^ WARN function cannot return without recursing (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` } diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr b/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr index 7adf68ee9b6..6465f1ccf33 100644 --- a/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr +++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr @@ -1,5 +1,17 @@ +warning: function cannot return without recursing + --> $DIR/region-bound-on-closure-outlives-call.rs:11:1 + | +LL | fn call_rec<F>(mut f: F) -> usize where F: FnMut(usize) -> usize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing +LL | //~^ WARN function cannot return without recursing +LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` + | ----------- recursive call site + | + = note: #[warn(unconditional_recursion)] on by default + = help: a `loop` may express intention better if this is on purpose + error[E0505]: cannot move out of `f` because it is borrowed - --> $DIR/region-bound-on-closure-outlives-call.rs:12:25 + --> $DIR/region-bound-on-closure-outlives-call.rs:13:25 | LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` | --- ^ move out of `f` occurs here |
