2021-08-31 04:03:49 -05:00
|
|
|
error[E0310]: the parameter type `T` may not live long enough
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/issue_74400.rs:12:5
|
2021-08-31 04:03:49 -05:00
|
|
|
|
|
|
|
|
LL | f(data, identity)
|
2022-04-24 10:04:31 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
2022-04-30 03:33:37 -05:00
|
|
|
|
|
|
|
|
help: consider adding an explicit lifetime bound...
|
|
|
|
|
|
|
|
|
LL | fn g<T: 'static>(data: &[T]) {
|
|
|
|
| +++++++++
|
2021-08-31 04:03:49 -05:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/issue_74400.rs:12:5
|
2021-08-31 04:03:49 -05:00
|
|
|
|
|
|
|
|
LL | f(data, identity)
|
|
|
|
| ^^^^^^^^^^^^^^^^^ one type is more general than the other
|
|
|
|
|
|
2022-09-21 10:57:30 -05:00
|
|
|
= note: expected trait `for<'a> Fn<(&'a T,)>`
|
2022-06-11 18:25:35 -05:00
|
|
|
found trait `Fn<(&T,)>`
|
2021-08-28 18:45:37 -05:00
|
|
|
note: the lifetime requirement is introduced here
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/issue_74400.rs:8:34
|
2021-08-28 18:45:37 -05:00
|
|
|
|
|
|
|
|
LL | fn f<T, S>(data: &[T], key: impl Fn(&T) -> S) {
|
|
|
|
| ^^^^^^^^^^^
|
2021-08-31 04:03:49 -05:00
|
|
|
|
|
|
|
error: implementation of `FnOnce` is not general enough
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/issue_74400.rs:12:5
|
2021-08-31 04:03:49 -05:00
|
|
|
|
|
|
|
|
LL | f(data, identity)
|
|
|
|
| ^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
|
|
|
|
|
|
|
|
= note: `fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `FnOnce<(&'1 T,)>`, for any lifetime `'1`...
|
|
|
|
= note: ...but it actually implements `FnOnce<(&'2 T,)>`, for some specific lifetime `'2`
|
|
|
|
|
|
|
|
error: aborting due to 3 previous errors
|
|
|
|
|
|
|
|
Some errors have detailed explanations: E0308, E0310.
|
|
|
|
For more information about an error, try `rustc --explain E0308`.
|