summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
blob: 93cfa60b5ab89d9fc31c676e68cf8e9c128b10f7 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
error[E0261]: use of undeclared lifetime name `'a`
  --> $DIR/missing-lifetimes-in-signature.rs:37:11
   |
LL | fn baz<G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
   |        -  ^^ undeclared lifetime
   |        |
   |        help: consider introducing lifetime `'a` here: `'a,`

error[E0700]: hidden type for `impl FnOnce()` captures lifetime that does not appear in bounds
  --> $DIR/missing-lifetimes-in-signature.rs:19:5
   |
LL |   fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce()
   |                            ------     ------------- opaque type defined here
   |                            |
   |                            hidden type `[closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 19:12]` captures the anonymous lifetime defined here
...
LL | /     move || {
LL | |
LL | |         *dest = g.get();
LL | |     }
   | |_____^
   |
help: to declare that `impl FnOnce()` captures `'_`, you can add an explicit `'_` lifetime bound
   |
LL | fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
   |                                                   ++++

error[E0311]: the parameter type `G` may not live long enough
  --> $DIR/missing-lifetimes-in-signature.rs:30:5
   |
LL | /     move || {
LL | |
LL | |         *dest = g.get();
LL | |     }
   | |_____^
   |
note: the parameter type `G` must be valid for the anonymous lifetime defined here...
  --> $DIR/missing-lifetimes-in-signature.rs:26:26
   |
LL | fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
   |                          ^^^^^^
note: ...so that the type `G` will meet its required lifetime bounds
  --> $DIR/missing-lifetimes-in-signature.rs:30:5
   |
LL | /     move || {
LL | |
LL | |         *dest = g.get();
LL | |     }
   | |_____^
help: consider adding an explicit lifetime bound...
   |
LL ~ fn bar<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + '_
LL | where
LL ~     G: Get<T> + 'a,
   |

error[E0311]: the parameter type `G` may not live long enough
  --> $DIR/missing-lifetimes-in-signature.rs:52:5
   |
LL | /     move || {
LL | |
LL | |         *dest = g.get();
LL | |     }
   | |_____^
   |
note: the parameter type `G` must be valid for the anonymous lifetime defined here...
  --> $DIR/missing-lifetimes-in-signature.rs:48:34
   |
LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
   |                                  ^^^^^^
note: ...so that the type `G` will meet its required lifetime bounds
  --> $DIR/missing-lifetimes-in-signature.rs:52:5
   |
LL | /     move || {
LL | |
LL | |         *dest = g.get();
LL | |     }
   | |_____^
help: consider adding an explicit lifetime bound...
   |
LL | fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + '_
   |        +++           ++++                  ++

error[E0311]: the parameter type `G` may not live long enough
  --> $DIR/missing-lifetimes-in-signature.rs:61:9
   |
LL | /         move || {
LL | |
LL | |             *dest = g.get();
LL | |         }
   | |_________^
   |
note: the parameter type `G` must be valid for the anonymous lifetime defined here...
  --> $DIR/missing-lifetimes-in-signature.rs:60:47
   |
LL |     fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
   |                                               ^^^^^^
note: ...so that the type `G` will meet its required lifetime bounds
  --> $DIR/missing-lifetimes-in-signature.rs:61:9
   |
LL | /         move || {
LL | |
LL | |             *dest = g.get();
LL | |         }
   | |_________^
help: consider adding an explicit lifetime bound...
   |
LL |     fn qux<'c, 'b, G: Get<T> + 'b + 'c, T>(g: G, dest: &'c mut T) -> impl FnOnce() + '_ {
   |            +++                    ++++                  ++

error[E0311]: the parameter type `G` may not live long enough
  --> $DIR/missing-lifetimes-in-signature.rs:73:5
   |
LL | /     move || {
LL | |
LL | |
LL | |         *dest = g.get();
LL | |     }
   | |_____^
   |
note: the parameter type `G` must be valid for the anonymous lifetime defined here...
  --> $DIR/missing-lifetimes-in-signature.rs:69:34
   |
LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
   |                                  ^^^^^^
note: ...so that the type `G` will meet its required lifetime bounds
  --> $DIR/missing-lifetimes-in-signature.rs:73:5
   |
LL | /     move || {
LL | |
LL | |
LL | |         *dest = g.get();
LL | |     }
   | |_____^
help: consider adding an explicit lifetime bound...
   |
LL | fn bat<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + '_ + 'a
   |        +++           ++++                  ++

error[E0621]: explicit lifetime required in the type of `dest`
  --> $DIR/missing-lifetimes-in-signature.rs:73:5
   |
LL |   fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
   |                                    ------ help: add explicit lifetime `'a` to the type of `dest`: `&'a mut T`
...
LL | /     move || {
LL | |
LL | |
LL | |         *dest = g.get();
LL | |     }
   | |_____^ lifetime `'a` required

error[E0309]: the parameter type `G` may not live long enough
  --> $DIR/missing-lifetimes-in-signature.rs:85:5
   |
LL | /     move || {
LL | |
LL | |         *dest = g.get();
LL | |     }
   | |_____^ ...so that the type `G` will meet its required lifetime bounds
   |
help: consider adding an explicit lifetime bound...
   |
LL |     G: Get<T> + 'a,
   |               ++++

error: aborting due to 8 previous errors

Some errors have detailed explanations: E0261, E0309, E0311, E0621, E0700.
For more information about an error, try `rustc --explain E0261`.