]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lifetimes/lifetime-errors/issue_74400.stderr
Rollup merge of #105555 - krasimirgg:llvm-int-opt-2, r=cuviper
[rust.git] / src / test / ui / lifetimes / lifetime-errors / issue_74400.stderr
1 error[E0310]: the parameter type `T` may not live long enough
2   --> $DIR/issue_74400.rs:12:5
3    |
4 LL |     f(data, identity)
5    |     ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
6    |
7 help: consider adding an explicit lifetime bound...
8    |
9 LL | fn g<T: 'static>(data: &[T]) {
10    |       +++++++++
11
12 error[E0308]: mismatched types
13   --> $DIR/issue_74400.rs:12:5
14    |
15 LL |     f(data, identity)
16    |     ^^^^^^^^^^^^^^^^^ one type is more general than the other
17    |
18    = note: expected trait `for<'a> Fn<(&'a T,)>`
19               found trait `Fn<(&T,)>`
20 note: the lifetime requirement is introduced here
21   --> $DIR/issue_74400.rs:8:34
22    |
23 LL | fn f<T, S>(data: &[T], key: impl Fn(&T) -> S) {
24    |                                  ^^^^^^^^^^^
25
26 error: implementation of `FnOnce` is not general enough
27   --> $DIR/issue_74400.rs:12:5
28    |
29 LL |     f(data, identity)
30    |     ^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
31    |
32    = note: `fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `FnOnce<(&'1 T,)>`, for any lifetime `'1`...
33    = note: ...but it actually implements `FnOnce<(&'2 T,)>`, for some specific lifetime `'2`
34
35 error: aborting due to 3 previous errors
36
37 Some errors have detailed explanations: E0308, E0310.
38 For more information about an error, try `rustc --explain E0308`.