fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #71868 - Mark-Simulacrum:stable-1.43.1, r=pietroalbini8d69840ab92

1.43.1
1.3 KiB30 linesraw
1error[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   |
4LL |     invoke(&x, |a, b| if a > b { a } else { b });
5   |     ^^^^^^
6   |
7note: 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   |
10LL |     invoke(&x, |a, b| if a > b { a } else { b });
11   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12note: ...so that reference does not outlive borrowed content
13  --> $DIR/E0621-does-not-trigger-for-closures.rs:15:45
14   |
15LL |     invoke(&x, |a, b| if a > b { a } else { b });
16   |                                             ^
17note: but, the lifetime must be valid for the call at 15:5...
18  --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5
19   |
20LL |     invoke(&x, |a, b| if a > b { a } else { b });
21   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22note: ...so type `&i32` of expression is valid during the expression
23  --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5
24   |
25LL |     invoke(&x, |a, b| if a > b { a } else { b });
26   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27
28error: aborting due to previous error
29
30For more information about this error, try `rustc --explain E0495`.