rust/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr

31 lines
1.3 KiB
Plaintext
Raw Normal View History

2018-02-07 21:35:35 -06:00
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
2018-12-25 09:56:47 -06:00
--> $DIR/E0621-does-not-trigger-for-closures.rs:15:5
2018-02-07 21:35:35 -06:00
|
2019-03-09 06:03:44 -06:00
LL | invoke(&x, |a, b| if a > b { a } else { b });
2018-02-07 21:35:35 -06:00
| ^^^^^^
|
2018-12-25 09:56:47 -06:00
note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 15:16...
--> $DIR/E0621-does-not-trigger-for-closures.rs:15:16
2018-02-07 21:35:35 -06:00
|
2019-03-09 06:03:44 -06:00
LL | invoke(&x, |a, b| if a > b { a } else { b });
2018-02-07 21:35:35 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...so that reference does not outlive borrowed content
2018-12-25 09:56:47 -06:00
--> $DIR/E0621-does-not-trigger-for-closures.rs:15:45
2018-02-07 21:35:35 -06:00
|
2019-03-09 06:03:44 -06:00
LL | invoke(&x, |a, b| if a > b { a } else { b });
2018-02-07 21:35:35 -06:00
| ^
2018-12-25 09:56:47 -06:00
note: but, the lifetime must be valid for the call at 15:5...
--> $DIR/E0621-does-not-trigger-for-closures.rs:15:5
2018-02-07 21:35:35 -06:00
|
2019-03-09 06:03:44 -06:00
LL | invoke(&x, |a, b| if a > b { a } else { b });
2018-02-07 21:35:35 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...so type `&i32` of expression is valid during the expression
2018-12-25 09:56:47 -06:00
--> $DIR/E0621-does-not-trigger-for-closures.rs:15:5
2018-02-07 21:35:35 -06:00
|
2019-03-09 06:03:44 -06:00
LL | invoke(&x, |a, b| if a > b { a } else { b });
2018-02-07 21:35:35 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
2019-09-12 08:00:44 -05:00
For more information about this error, try `rustc --explain E0495`.