]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.rs
Auto merge of #84589 - In-line:zircon-thread-name, r=JohnTitor
[rust.git] / src / test / ui / rust-2018 / edition-lint-infer-outlives-multispan.rs
1 #![allow(unused)]
2 #![deny(explicit_outlives_requirements)]
3
4
5 // These examples should live in edition-lint-infer-outlives.rs, but are split
6 // into this separate file because they can't be `rustfix`'d (and thus, can't
7 // be part of a `run-rustfix` test file) until rust-lang-nursery/rustfix#141
8 // is solved
9
10 mod structs {
11     use std::fmt::Debug;
12
13     struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> {
14         //~^ ERROR outlives requirements can be inferred
15         tee: &'a &'b T
16     }
17
18     struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b {
19         //~^ ERROR outlives requirements can be inferred
20         tee: &'a &'b T
21     }
22
23     struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> {
24         //~^ ERROR outlives requirements can be inferred
25         tee: T,
26         yoo: &'a &'b U
27     }
28
29     struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> {
30         //~^ ERROR outlives requirements can be inferred
31         tee: &'a T,
32         yoo: &'b U
33     }
34
35     struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> {
36         //~^ ERROR outlives requirements can be inferred
37         tee: &'a T,
38         yoo: &'b U
39     }
40
41     struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b {
42         //~^ ERROR outlives requirements can be inferred
43         tee: &'a T,
44         yoo: &'b U
45     }
46
47     struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b {
48         //~^ ERROR outlives requirements can be inferred
49         tee: T,
50         yoo: &'a &'b U
51     }
52
53     struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug {
54         //~^ ERROR outlives requirements can be inferred
55         tee: &'a T,
56         yoo: &'b U
57     }
58
59     struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b {
60         //~^ ERROR outlives requirements can be inferred
61         tee: &'a T,
62         yoo: &'b U
63     }
64
65     struct TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug {
66         //~^ ERROR outlives requirements can be inferred
67         tee: &'a T,
68         yoo: &'b U
69     }
70
71     struct TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b {
72         //~^ ERROR outlives requirements can be inferred
73         tee: &'a T,
74         yoo: &'b U
75     }
76
77     struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> {
78         //~^ ERROR outlives requirements can be inferred
79         tee: &'a &'b T,
80     }
81
82     struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> {
83         //~^ ERROR outlives requirements can be inferred
84         tee: &'a &'b T,
85     }
86
87     struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> {
88         //~^ ERROR outlives requirements can be inferred
89         tee: &'a &'b T
90     }
91
92     struct BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b {
93         //~^ ERROR outlives requirements can be inferred
94         tee: &'a &'b T
95     }
96
97     struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> {
98         //~^ ERROR outlives requirements can be inferred
99         tee: T,
100         yoo: &'a &'b U
101     }
102
103     struct BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U>
104         where U: 'a + Debug + 'b, 'b: 'a
105         //~^ ERROR outlives requirements can be inferred
106     {
107         tee: T,
108         yoo: &'a &'b U
109     }
110 }
111
112 mod tuple_structs {
113     use std::fmt::Debug;
114
115     struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b>(&'a &'b T);
116     //~^ ERROR outlives requirements can be inferred
117
118     struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: 'a + Debug + 'b;
119     //~^ ERROR outlives requirements can be inferred
120
121     struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b>(T, &'a &'b U);
122     //~^ ERROR outlives requirements can be inferred
123
124     struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug>(&'a T, &'b U);
125     //~^ ERROR outlives requirements can be inferred
126
127     struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b>(&'a T, &'b U);
128     //~^ ERROR outlives requirements can be inferred
129
130     struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b;
131     //~^ ERROR outlives requirements can be inferred
132
133     struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + Debug + 'b;
134     //~^ ERROR outlives requirements can be inferred
135
136     struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b + Debug;
137     //~^ ERROR outlives requirements can be inferred
138
139     struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: Debug + 'b;
140     //~^ ERROR outlives requirements can be inferred
141
142     struct TeeWhereAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: 'b + Debug;
143     //~^ ERROR outlives requirements can be inferred
144
145     struct TeeWhereAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: Debug + 'b;
146     //~^ ERROR outlives requirements can be inferred
147
148     struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b>(&'a &'b T);
149     //~^ ERROR outlives requirements can be inferred
150
151     struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b>(&'a &'b T);
152     //~^ ERROR outlives requirements can be inferred
153
154     struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b>(&'a &'b T);
155     //~^ ERROR outlives requirements can be inferred
156
157     struct BeeWhereAyTeeWhereAyIsDebugBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'a + Debug + 'b;
158     //~^ ERROR outlives requirements can be inferred
159
160     struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b>(T, &'a &'b U);
161     //~^ ERROR outlives requirements can be inferred
162
163     struct BeeWhereAyTeeYooWhereAyIsDebugBee<'a, 'b, T, U>(T, &'a &'b U)
164         where U: 'a + Debug + 'b, 'b: 'a;
165     //~^ ERROR outlives requirements can be inferred
166 }
167
168 mod enums {
169     use std::fmt::Debug;
170
171     enum TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> {
172         //~^ ERROR outlives requirements can be inferred
173         V { tee: &'a &'b T },
174     }
175
176     enum TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b {
177         //~^ ERROR outlives requirements can be inferred
178         V(&'a &'b T),
179     }
180
181     enum TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> {
182         //~^ ERROR outlives requirements can be inferred
183         V { tee: T, },
184         W(&'a &'b U),
185     }
186
187     enum TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> {
188         //~^ ERROR outlives requirements can be inferred
189         V { tee: &'a T, yoo: &'b U },
190         W,
191     }
192
193     enum TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> {
194         //~^ ERROR outlives requirements can be inferred
195         V(&'a T, &'b U),
196         W,
197     }
198
199     enum TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b {
200         //~^ ERROR outlives requirements can be inferred
201         V { tee: &'a T },
202         W(&'b U),
203     }
204
205     enum TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b {
206         //~^ ERROR outlives requirements can be inferred
207         V { tee: T, yoo: &'a &'b U },
208         W,
209     }
210
211     enum TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug {
212         //~^ ERROR outlives requirements can be inferred
213         V(&'a T, &'b U),
214         W,
215     }
216
217     enum TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b {
218         //~^ ERROR outlives requirements can be inferred
219         V { tee: &'a T },
220         W(&'b U)
221     }
222
223     enum TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug {
224         //~^ ERROR outlives requirements can be inferred
225         V { tee: &'a T, yoo: &'b U },
226         W,
227     }
228
229     enum TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b {
230         //~^ ERROR outlives requirements can be inferred
231         V(&'a T, &'b U),
232         W,
233     }
234
235     enum BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> {
236         //~^ ERROR outlives requirements can be inferred
237         V { tee: &'a &'b T },
238     }
239
240     enum BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> {
241         //~^ ERROR outlives requirements can be inferred
242         V { tee: &'a &'b T },
243         W,
244     }
245
246     enum BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> {
247         //~^ ERROR outlives requirements can be inferred
248         V { tee: &'a &'b T },
249     }
250
251     enum BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b {
252         //~^ ERROR outlives requirements can be inferred
253         V(&'a &'b T),
254     }
255
256     enum BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> {
257         //~^ ERROR outlives requirements can be inferred
258         V { tee: T },
259         W(&'a &'b U),
260     }
261
262     enum BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a {
263         //~^ ERROR outlives requirements can be inferred
264         V { tee: T, yoo: &'a &'b U },
265     }
266 }
267
268 mod unions {
269     use std::fmt::Debug;
270
271     union TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> {
272         //~^ ERROR outlives requirements can be inferred
273         tee: &'a &'b T
274     }
275
276     union TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b {
277         //~^ ERROR outlives requirements can be inferred
278         tee: &'a &'b T
279     }
280
281     union TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> {
282         //~^ ERROR outlives requirements can be inferred
283         tee: *const T,
284         yoo: &'a &'b U
285     }
286
287     union TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> {
288         //~^ ERROR outlives requirements can be inferred
289         tee: &'a T,
290         yoo: &'b U
291     }
292
293     union TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> {
294         //~^ ERROR outlives requirements can be inferred
295         tee: &'a T,
296         yoo: &'b U
297     }
298
299     union TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b {
300         //~^ ERROR outlives requirements can be inferred
301         tee: &'a T,
302         yoo: &'b U
303     }
304
305     union TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b {
306         //~^ ERROR outlives requirements can be inferred
307         tee: *const T,
308         yoo: &'a &'b U
309     }
310
311     union TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug {
312         //~^ ERROR outlives requirements can be inferred
313         tee: &'a T,
314         yoo: &'b U
315     }
316
317     union TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b {
318         //~^ ERROR outlives requirements can be inferred
319         tee: &'a T,
320         yoo: &'b U
321     }
322
323     union TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug {
324         //~^ ERROR outlives requirements can be inferred
325         tee: &'a T,
326         yoo: &'b U
327     }
328
329     union TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b {
330         //~^ ERROR outlives requirements can be inferred
331         tee: &'a T,
332         yoo: &'b U
333     }
334
335     union BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> {
336         //~^ ERROR outlives requirements can be inferred
337         tee: &'a &'b T,
338     }
339
340     union BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> {
341         //~^ ERROR outlives requirements can be inferred
342         tee: &'a &'b T,
343     }
344
345     union BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> {
346         //~^ ERROR outlives requirements can be inferred
347         tee: &'a &'b T
348     }
349
350     union BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b {
351         //~^ ERROR outlives requirements can be inferred
352         tee: &'a &'b T
353     }
354
355     union BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> {
356         //~^ ERROR outlives requirements can be inferred
357         tee: *const T,
358         yoo: &'a &'b U
359     }
360
361     union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a {
362         //~^ ERROR outlives requirements can be inferred
363         tee: *const T,
364         yoo: &'a &'b U
365     }
366 }
367
368 fn main() {}