]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
Auto merge of #75789 - matthiaskrgr:clippy_compiletest, r=Dylan-DPC
[rust.git] / src / test / ui / suggestions / lifetimes / missing-lifetimes-in-signature.stderr
1 error[E0261]: use of undeclared lifetime name `'a`
2   --> $DIR/missing-lifetimes-in-signature.rs:37:11
3    |
4 LL | fn baz<G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
5    |        -  ^^ undeclared lifetime
6    |        |
7    |        help: consider introducing lifetime `'a` here: `'a,`
8
9 error[E0759]: `dest` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
10   --> $DIR/missing-lifetimes-in-signature.rs:19:5
11    |
12 LL |   fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce()
13    |                            ------ this data with an anonymous lifetime `'_`...
14 ...
15 LL | /     move || {
16 LL | |         *dest = g.get();
17 LL | |     }
18    | |_____^ ...is captured here...
19    |
20 note: ...and is required to live as long as `'static` here
21   --> $DIR/missing-lifetimes-in-signature.rs:15:37
22    |
23 LL | fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce()
24    |                                     ^^^^^^^^^^^^^
25 help: to declare that the `impl Trait` captures data from argument `dest`, you can add an explicit `'_` lifetime bound
26    |
27 LL | fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
28    |                                                   ^^^^
29
30 error[E0311]: the parameter type `G` may not live long enough
31   --> $DIR/missing-lifetimes-in-signature.rs:25:37
32    |
33 LL | fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
34    |                                     ^^^^^^^^^^^^^^^^^^
35    |
36 note: the parameter type `G` must be valid for the anonymous lifetime #1 defined on the function body at 25:1...
37   --> $DIR/missing-lifetimes-in-signature.rs:25:1
38    |
39 LL | / fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
40 LL | |
41 LL | | where
42 LL | |     G: Get<T>
43    | |_____________^
44 note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:30:5: 32:6 g:G, dest:&mut T]` will meet its required lifetime bounds
45   --> $DIR/missing-lifetimes-in-signature.rs:25:37
46    |
47 LL | fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
48    |                                     ^^^^^^^^^^^^^^^^^^
49 help: consider introducing an explicit lifetime bound
50    |
51 LL | fn bar<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
52    |        ^^^^^                                                   ^^^^
53
54 error[E0311]: the parameter type `G` may not live long enough
55   --> $DIR/missing-lifetimes-in-signature.rs:47:45
56    |
57 LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
58    |                                             ^^^^^^^^^^^^^^^^^^
59    |
60 note: the parameter type `G` must be valid for the anonymous lifetime #1 defined on the function body at 47:1...
61   --> $DIR/missing-lifetimes-in-signature.rs:47:1
62    |
63 LL | / fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
64 LL | |
65 LL | | where
66 LL | |     G: Get<T>
67    | |_____________^
68 note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:52:5: 54:6 g:G, dest:&mut T]` will meet its required lifetime bounds
69   --> $DIR/missing-lifetimes-in-signature.rs:47:45
70    |
71 LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
72    |                                             ^^^^^^^^^^^^^^^^^^
73 help: consider introducing an explicit lifetime bound
74    |
75 LL | fn qux<'b, 'a, G: 'b + 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'b
76    |        ^^^     ^^^^^^^                                                  ^^^^
77
78 error[E0311]: the parameter type `G` may not live long enough
79   --> $DIR/missing-lifetimes-in-signature.rs:59:58
80    |
81 LL |     fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
82    |                                                          ^^^^^^^^^^^^^^^^^^
83    |
84 note: the parameter type `G` must be valid for the anonymous lifetime #1 defined on the method body at 59:5...
85   --> $DIR/missing-lifetimes-in-signature.rs:59:5
86    |
87 LL |     fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
88    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
89 note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:61:9: 63:10 g:G, dest:&mut T]` will meet its required lifetime bounds
90   --> $DIR/missing-lifetimes-in-signature.rs:59:58
91    |
92 LL |     fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
93    |                                                          ^^^^^^^^^^^^^^^^^^
94 help: consider introducing an explicit lifetime bound
95    |
96 LL |     fn qux<'c, 'b, G: 'c + Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'c {
97    |            ^^^     ^^^^^^^                                                           ^^^^
98
99 error[E0621]: explicit lifetime required in the type of `dest`
100   --> $DIR/missing-lifetimes-in-signature.rs:68:45
101    |
102 LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
103    |                                  ------     ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
104    |                                  |
105    |                                  help: add explicit lifetime `'a` to the type of `dest`: `&'a mut T`
106
107 error[E0309]: the parameter type `G` may not live long enough
108   --> $DIR/missing-lifetimes-in-signature.rs:79:44
109    |
110 LL | fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a
111    |            -                               ^^^^^^^^^^^^^^^^^^ ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:84:5: 86:6 g:G, dest:&mut T]` will meet its required lifetime bounds
112    |            |
113    |            help: consider adding an explicit lifetime bound...: `G: 'a`
114
115 error: aborting due to 7 previous errors
116
117 Some errors have detailed explanations: E0261, E0309, E0621, E0759.
118 For more information about an error, try `rustc --explain E0261`.