fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.3 KiB38 linesraw
1error[E0310]: the parameter type `T` may not live long enough
2  --> $DIR/issue_74400.rs:12:5
3   |
4LL |     f(data, identity)
5   |     ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
6   |
7help: consider adding an explicit lifetime bound...
8   |
9LL | fn g<T: 'static>(data: &[T]) {
10   |       +++++++++
11
12error[E0308]: mismatched types
13  --> $DIR/issue_74400.rs:12:5
14   |
15LL |     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,)>`
20note: the lifetime requirement is introduced here
21  --> $DIR/issue_74400.rs:8:34
22   |
23LL | fn f<T, S>(data: &[T], key: impl Fn(&T) -> S) {
24   |                                  ^^^^^^^^^^^
25
26error: implementation of `FnOnce` is not general enough
27  --> $DIR/issue_74400.rs:12:5
28   |
29LL |     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
35error: aborting due to 3 previous errors
36
37Some errors have detailed explanations: E0308, E0310.
38For more information about an error, try `rustc --explain E0308`.