]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
Auto merge of #74784 - anp:track-vtables, r=eddyb
[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 LL | |     }
45 LL | | }
46    | |_^
47 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
48   --> $DIR/missing-lifetimes-in-signature.rs:25:37
49    |
50 LL | fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
51    |                                     ^^^^^^^^^^^^^^^^^^
52 help: consider introducing an explicit lifetime bound
53    |
54 LL | fn bar<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
55    |        ^^^^^                                                   ^^^^
56
57 error[E0311]: the parameter type `G` may not live long enough
58   --> $DIR/missing-lifetimes-in-signature.rs:47:45
59    |
60 LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
61    |                                             ^^^^^^^^^^^^^^^^^^
62    |
63 note: the parameter type `G` must be valid for the anonymous lifetime #1 defined on the function body at 47:1...
64   --> $DIR/missing-lifetimes-in-signature.rs:47:1
65    |
66 LL | / fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
67 LL | |
68 LL | | where
69 LL | |     G: Get<T>
70 ...  |
71 LL | |     }
72 LL | | }
73    | |_^
74 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
75   --> $DIR/missing-lifetimes-in-signature.rs:47:45
76    |
77 LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
78    |                                             ^^^^^^^^^^^^^^^^^^
79 help: consider introducing an explicit lifetime bound
80    |
81 LL | fn qux<'b, 'a, G: 'b + 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'b
82    |        ^^^     ^^^^^^^                                                  ^^^^
83
84 error[E0311]: the parameter type `G` may not live long enough
85   --> $DIR/missing-lifetimes-in-signature.rs:59:58
86    |
87 LL |     fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
88    |                                                          ^^^^^^^^^^^^^^^^^^
89    |
90 note: the parameter type `G` must be valid for the anonymous lifetime #1 defined on the method body at 59:5...
91   --> $DIR/missing-lifetimes-in-signature.rs:59:5
92    |
93 LL | /     fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
94 LL | |
95 LL | |         move || {
96 LL | |             *dest = g.get();
97 LL | |         }
98 LL | |     }
99    | |_____^
100 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
101   --> $DIR/missing-lifetimes-in-signature.rs:59:58
102    |
103 LL |     fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
104    |                                                          ^^^^^^^^^^^^^^^^^^
105 help: consider introducing an explicit lifetime bound
106    |
107 LL |     fn qux<'c, 'b, G: 'c + Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'c {
108    |            ^^^     ^^^^^^^                                                           ^^^^
109
110 error[E0621]: explicit lifetime required in the type of `dest`
111   --> $DIR/missing-lifetimes-in-signature.rs:68:45
112    |
113 LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
114    |                                  ------     ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
115    |                                  |
116    |                                  help: add explicit lifetime `'a` to the type of `dest`: `&'a mut T`
117
118 error[E0309]: the parameter type `G` may not live long enough
119   --> $DIR/missing-lifetimes-in-signature.rs:79:44
120    |
121 LL | fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a
122    |            -                               ^^^^^^^^^^^^^^^^^^ ...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
123    |            |
124    |            help: consider adding an explicit lifetime bound...: `G: 'a`
125
126 error: aborting due to 7 previous errors
127
128 Some errors have detailed explanations: E0261, E0309, E0621, E0759.
129 For more information about an error, try `rustc --explain E0261`.