rust/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr
2023-01-11 09:32:08 +00:00

39 lines
1.3 KiB
Plaintext

error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue_74400.rs:12:5
|
LL | f(data, identity)
| ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
LL | fn g<T: 'static>(data: &[T]) {
| +++++++++
error[E0308]: mismatched types
--> $DIR/issue_74400.rs:12:5
|
LL | f(data, identity)
| ^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected trait `for<'a> Fn<(&'a T,)>`
found trait `Fn<(&T,)>`
note: the lifetime requirement is introduced here
--> $DIR/issue_74400.rs:8:34
|
LL | fn f<T, S>(data: &[T], key: impl Fn(&T) -> S) {
| ^^^^^^^^^^^
error: implementation of `FnOnce` is not general enough
--> $DIR/issue_74400.rs:12:5
|
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`.