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/regions | |
| 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/regions')
3 files changed, 27 insertions, 2 deletions
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 |
