summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lifetimes/lifetime-errors/issue_74400.stderr
blob: 7049f28e2f6eb37e89b328b7644c00fdef268f72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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`.