]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr
feca7f10b706b22890178427631abd62ee72cbff
[rust.git] / src / test / ui / error-codes / E0621-does-not-trigger-for-closures.stderr
1 error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
2   --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5
3    |
4 LL |     invoke(&x, |a, b| if a > b { a } else { b });
5    |     ^^^^^^
6    |
7 note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 15:16...
8   --> $DIR/E0621-does-not-trigger-for-closures.rs:15:16
9    |
10 LL |     invoke(&x, |a, b| if a > b { a } else { b });
11    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 note: ...so that reference does not outlive borrowed content
13   --> $DIR/E0621-does-not-trigger-for-closures.rs:15:45
14    |
15 LL |     invoke(&x, |a, b| if a > b { a } else { b });
16    |                                             ^
17 note: but, the lifetime must be valid for the call at 15:5...
18   --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5
19    |
20 LL |     invoke(&x, |a, b| if a > b { a } else { b });
21    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22 note: ...so type `&i32` of expression is valid during the expression
23   --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5
24    |
25 LL |     invoke(&x, |a, b| if a > b { a } else { b });
26    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27
28 error: aborting due to previous error
29
30 For more information about this error, try `rustc --explain E0495`.