]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / regions / region-bound-on-closure-outlives-call.nll.stderr
1 warning: function cannot return without recursing
2   --> $DIR/region-bound-on-closure-outlives-call.rs:1:1
3    |
4 LL | fn call_rec<F>(mut f: F) -> usize where F: FnMut(usize) -> usize {
5    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
6 LL |     //~^ WARN function cannot return without recursing
7 LL |     (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f`
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
13 error[E0505]: cannot move out of `f` because it is borrowed
14   --> $DIR/region-bound-on-closure-outlives-call.rs:3:25
15    |
16 LL |     (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f`
17    |     ----------          ^ move out of `f` occurs here
18    |     ||   |
19    |     ||   borrow occurs due to use in closure
20    |     |borrow of `f` occurs here
21    |     borrow later used by call
22
23 error: aborting due to previous error
24
25 For more information about this error, try `rustc --explain E0505`.