]>
Commit | Line | Data |
---|---|---|
c30ab7b3 SL |
1 | // This test case tests the incremental compilation hash (ICH) implementation |
2 | // for enum definitions. | |
3 | ||
4 | // The general pattern followed here is: Change one thing between rev1 and rev2 | |
5 | // and make sure that the hash has changed, then change nothing between rev2 and | |
6 | // rev3 and make sure that the hash has not changed. | |
7 | ||
8 | // We also test the ICH for enum definitions exported in metadata. Same as | |
9 | // above, we want to make sure that the change between rev1 and rev2 also | |
10 | // results in a change of the ICH for the enum's metadata, and that it stays | |
11 | // the same between rev2 and rev3. | |
12 | ||
416331ca | 13 | // build-pass (FIXME(62277): could be check-pass?) |
c295e0f8 | 14 | // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 |
923072b8 | 15 | // compile-flags: -Z query-dep-graph -O |
c295e0f8 XL |
16 | // [cfail1]compile-flags: -Zincremental-ignore-spans |
17 | // [cfail2]compile-flags: -Zincremental-ignore-spans | |
18 | // [cfail3]compile-flags: -Zincremental-ignore-spans | |
19 | // [cfail4]compile-flags: -Zincremental-relative-spans | |
20 | // [cfail5]compile-flags: -Zincremental-relative-spans | |
21 | // [cfail6]compile-flags: -Zincremental-relative-spans | |
c30ab7b3 SL |
22 | |
23 | #![allow(warnings)] | |
24 | #![feature(rustc_attrs)] | |
cc61c64b | 25 | #![feature(stmt_expr_attributes)] |
c30ab7b3 SL |
26 | #![crate_type="rlib"] |
27 | ||
28 | ||
29 | ||
30 | // Change enum visibility ----------------------------------------------------- | |
c295e0f8 | 31 | #[cfg(any(cfail1,cfail4))] |
04454e1e | 32 | enum EnumVisibility { A } |
c30ab7b3 | 33 | |
c295e0f8 | 34 | #[cfg(not(any(cfail1,cfail4)))] |
04454e1e | 35 | #[rustc_clean(cfg="cfail2")] |
abe05a73 | 36 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
37 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")] |
38 | #[rustc_clean(cfg="cfail6")] | |
04454e1e | 39 | pub enum EnumVisibility { A } |
c30ab7b3 SL |
40 | |
41 | ||
42 | ||
43 | // Change name of a c-style variant ------------------------------------------- | |
c295e0f8 | 44 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
45 | enum EnumChangeNameCStyleVariant { |
46 | Variant1, | |
47 | Variant2, | |
48 | } | |
49 | ||
c295e0f8 | 50 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 51 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 52 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
53 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
54 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
55 | enum EnumChangeNameCStyleVariant { |
56 | Variant1, | |
57 | Variant2Changed, | |
58 | } | |
59 | ||
60 | ||
61 | ||
62 | // Change name of a tuple-style variant --------------------------------------- | |
c295e0f8 | 63 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
64 | enum EnumChangeNameTupleStyleVariant { |
65 | Variant1, | |
66 | Variant2(u32, f32), | |
67 | } | |
68 | ||
c295e0f8 | 69 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 70 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 71 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
72 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
73 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
74 | enum EnumChangeNameTupleStyleVariant { |
75 | Variant1, | |
76 | Variant2Changed(u32, f32), | |
77 | } | |
78 | ||
79 | ||
80 | ||
81 | // Change name of a struct-style variant -------------------------------------- | |
c295e0f8 | 82 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
83 | enum EnumChangeNameStructStyleVariant { |
84 | Variant1, | |
85 | Variant2 { a: u32, b: f32 }, | |
86 | } | |
87 | ||
c295e0f8 | 88 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 89 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 90 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
91 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
92 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
93 | enum EnumChangeNameStructStyleVariant { |
94 | Variant1, | |
95 | Variant2Changed { a: u32, b: f32 }, | |
96 | } | |
97 | ||
98 | ||
99 | ||
100 | // Change the value of a c-style variant -------------------------------------- | |
c295e0f8 | 101 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
102 | enum EnumChangeValueCStyleVariant0 { |
103 | Variant1, | |
104 | Variant2 = 11, | |
105 | } | |
106 | ||
c295e0f8 | 107 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 108 | #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] |
abe05a73 | 109 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
110 | #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] |
111 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
112 | enum EnumChangeValueCStyleVariant0 { |
113 | Variant1, | |
c295e0f8 | 114 | Variant2 = 22, |
c30ab7b3 SL |
115 | } |
116 | ||
c295e0f8 | 117 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
118 | enum EnumChangeValueCStyleVariant1 { |
119 | Variant1, | |
120 | Variant2, | |
121 | } | |
122 | ||
c295e0f8 | 123 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 124 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 125 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
126 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
127 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
128 | enum EnumChangeValueCStyleVariant1 { |
129 | Variant1, | |
130 | Variant2 = 11, | |
131 | } | |
132 | ||
133 | ||
134 | ||
135 | // Add a c-style variant ------------------------------------------------------ | |
c295e0f8 | 136 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
137 | enum EnumAddCStyleVariant { |
138 | Variant1, | |
139 | } | |
140 | ||
c295e0f8 | 141 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 142 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 143 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
144 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
145 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
146 | enum EnumAddCStyleVariant { |
147 | Variant1, | |
148 | Variant2, | |
149 | } | |
150 | ||
151 | ||
152 | ||
153 | // Remove a c-style variant --------------------------------------------------- | |
c295e0f8 | 154 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
155 | enum EnumRemoveCStyleVariant { |
156 | Variant1, | |
157 | Variant2, | |
158 | } | |
159 | ||
c295e0f8 | 160 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 161 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 162 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
163 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
164 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
165 | enum EnumRemoveCStyleVariant { |
166 | Variant1, | |
167 | } | |
168 | ||
169 | ||
170 | ||
171 | // Add a tuple-style variant -------------------------------------------------- | |
c295e0f8 | 172 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
173 | enum EnumAddTupleStyleVariant { |
174 | Variant1, | |
175 | } | |
176 | ||
c295e0f8 | 177 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 178 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 179 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
180 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
181 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
182 | enum EnumAddTupleStyleVariant { |
183 | Variant1, | |
184 | Variant2(u32, f32), | |
185 | } | |
186 | ||
187 | ||
188 | ||
189 | // Remove a tuple-style variant ----------------------------------------------- | |
c295e0f8 | 190 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
191 | enum EnumRemoveTupleStyleVariant { |
192 | Variant1, | |
193 | Variant2(u32, f32), | |
194 | } | |
195 | ||
c295e0f8 | 196 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 197 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 198 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
199 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
200 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
201 | enum EnumRemoveTupleStyleVariant { |
202 | Variant1, | |
203 | } | |
204 | ||
205 | ||
206 | ||
207 | // Add a struct-style variant ------------------------------------------------- | |
c295e0f8 | 208 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
209 | enum EnumAddStructStyleVariant { |
210 | Variant1, | |
211 | } | |
212 | ||
c295e0f8 | 213 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 214 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 215 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
216 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
217 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
218 | enum EnumAddStructStyleVariant { |
219 | Variant1, | |
220 | Variant2 { a: u32, b: f32 }, | |
221 | } | |
222 | ||
223 | ||
224 | ||
225 | // Remove a struct-style variant ---------------------------------------------- | |
c295e0f8 | 226 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
227 | enum EnumRemoveStructStyleVariant { |
228 | Variant1, | |
229 | Variant2 { a: u32, b: f32 }, | |
230 | } | |
231 | ||
c295e0f8 | 232 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 233 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 234 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
235 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
236 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
237 | enum EnumRemoveStructStyleVariant { |
238 | Variant1, | |
239 | } | |
240 | ||
241 | ||
242 | ||
243 | // Change the type of a field in a tuple-style variant ------------------------ | |
c295e0f8 | 244 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
245 | enum EnumChangeFieldTypeTupleStyleVariant { |
246 | Variant1(u32, u32), | |
247 | } | |
248 | ||
c295e0f8 | 249 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 250 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] |
abe05a73 | 251 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
252 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")] |
253 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 | 254 | enum EnumChangeFieldTypeTupleStyleVariant { |
cc61c64b | 255 | Variant1(u32, |
cc61c64b | 256 | u64), |
c30ab7b3 SL |
257 | } |
258 | ||
259 | ||
260 | ||
261 | // Change the type of a field in a struct-style variant ----------------------- | |
c295e0f8 | 262 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
263 | enum EnumChangeFieldTypeStructStyleVariant { |
264 | Variant1, | |
265 | Variant2 { a: u32, b: u32 }, | |
266 | } | |
267 | ||
c295e0f8 | 268 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 269 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] |
abe05a73 | 270 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
271 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")] |
272 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
273 | enum EnumChangeFieldTypeStructStyleVariant { |
274 | Variant1, | |
cc61c64b XL |
275 | Variant2 { |
276 | a: u32, | |
cc61c64b XL |
277 | b: u64 |
278 | }, | |
c30ab7b3 SL |
279 | } |
280 | ||
281 | ||
282 | ||
283 | // Change the name of a field in a struct-style variant ----------------------- | |
c295e0f8 | 284 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
285 | enum EnumChangeFieldNameStructStyleVariant { |
286 | Variant1 { a: u32, b: u32 }, | |
287 | } | |
288 | ||
c295e0f8 | 289 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 290 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 291 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
292 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
293 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
294 | enum EnumChangeFieldNameStructStyleVariant { |
295 | Variant1 { a: u32, c: u32 }, | |
296 | } | |
297 | ||
298 | ||
299 | ||
300 | // Change order of fields in a tuple-style variant ---------------------------- | |
c295e0f8 | 301 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
302 | enum EnumChangeOrderTupleStyleVariant { |
303 | Variant1(u32, u64), | |
304 | } | |
305 | ||
c295e0f8 | 306 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 307 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] |
abe05a73 | 308 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
309 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")] |
310 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 | 311 | enum EnumChangeOrderTupleStyleVariant { |
cc61c64b | 312 | Variant1( |
cc61c64b | 313 | u64, |
cc61c64b | 314 | u32), |
c30ab7b3 SL |
315 | } |
316 | ||
317 | ||
318 | ||
319 | // Change order of fields in a struct-style variant --------------------------- | |
c295e0f8 | 320 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
321 | enum EnumChangeFieldOrderStructStyleVariant { |
322 | Variant1 { a: u32, b: f32 }, | |
323 | } | |
324 | ||
c295e0f8 | 325 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 326 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 327 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
328 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
329 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
330 | enum EnumChangeFieldOrderStructStyleVariant { |
331 | Variant1 { b: f32, a: u32 }, | |
332 | } | |
333 | ||
334 | ||
335 | ||
336 | // Add a field to a tuple-style variant --------------------------------------- | |
c295e0f8 | 337 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
338 | enum EnumAddFieldTupleStyleVariant { |
339 | Variant1(u32, u32), | |
340 | } | |
341 | ||
c295e0f8 | 342 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 343 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 344 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
345 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
346 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
347 | enum EnumAddFieldTupleStyleVariant { |
348 | Variant1(u32, u32, u32), | |
349 | } | |
350 | ||
351 | ||
352 | ||
353 | // Add a field to a struct-style variant -------------------------------------- | |
c295e0f8 | 354 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
355 | enum EnumAddFieldStructStyleVariant { |
356 | Variant1 { a: u32, b: u32 }, | |
357 | } | |
358 | ||
c295e0f8 | 359 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 360 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] |
abe05a73 | 361 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
362 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")] |
363 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
364 | enum EnumAddFieldStructStyleVariant { |
365 | Variant1 { a: u32, b: u32, c: u32 }, | |
366 | } | |
367 | ||
368 | ||
369 | ||
370 | // Add #[must_use] to the enum ------------------------------------------------ | |
c295e0f8 | 371 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
372 | enum EnumAddMustUse { |
373 | Variant1, | |
374 | Variant2, | |
375 | } | |
376 | ||
c295e0f8 | 377 | #[cfg(not(any(cfail1,cfail4)))] |
6a06907d | 378 | #[rustc_clean(cfg="cfail2")] |
abe05a73 | 379 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
380 | #[rustc_clean(cfg="cfail5")] |
381 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
382 | #[must_use] |
383 | enum EnumAddMustUse { | |
384 | Variant1, | |
385 | Variant2, | |
386 | } | |
387 | ||
388 | ||
389 | ||
390 | // Add #[repr(C)] to the enum ------------------------------------------------- | |
c295e0f8 | 391 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
392 | enum EnumAddReprC { |
393 | Variant1, | |
394 | Variant2, | |
395 | } | |
396 | ||
c295e0f8 | 397 | #[cfg(not(any(cfail1,cfail4)))] |
6a06907d | 398 | #[rustc_clean(cfg="cfail2", except="type_of")] |
abe05a73 | 399 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
400 | #[rustc_clean(cfg="cfail5", except="type_of")] |
401 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
402 | #[repr(C)] |
403 | enum EnumAddReprC { | |
404 | Variant1, | |
405 | Variant2, | |
406 | } | |
407 | ||
408 | ||
409 | ||
410 | // Change the name of a type parameter ---------------------------------------- | |
c295e0f8 | 411 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
412 | enum EnumChangeNameOfTypeParameter<S> { |
413 | Variant1(S), | |
414 | } | |
415 | ||
c295e0f8 | 416 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 | 417 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")] |
abe05a73 | 418 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
419 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")] |
420 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
421 | enum EnumChangeNameOfTypeParameter<T> { |
422 | Variant1(T), | |
423 | } | |
424 | ||
425 | ||
426 | ||
427 | // Add a type parameter ------------------------------------------------------ | |
c295e0f8 | 428 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
429 | enum EnumAddTypeParameter<S> { |
430 | Variant1(S), | |
431 | Variant2(S), | |
432 | } | |
433 | ||
c295e0f8 | 434 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 | 435 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")] |
abe05a73 | 436 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
437 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")] |
438 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
439 | enum EnumAddTypeParameter<S, T> { |
440 | Variant1(S), | |
441 | Variant2(T), | |
442 | } | |
443 | ||
444 | ||
445 | ||
446 | // Change the name of a lifetime parameter ------------------------------------ | |
c295e0f8 | 447 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
448 | enum EnumChangeNameOfLifetimeParameter<'a> { |
449 | Variant1(&'a u32), | |
450 | } | |
451 | ||
c295e0f8 | 452 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 | 453 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,type_of")] |
abe05a73 | 454 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
455 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,type_of")] |
456 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
457 | enum EnumChangeNameOfLifetimeParameter<'b> { |
458 | Variant1(&'b u32), | |
459 | } | |
460 | ||
461 | ||
462 | ||
463 | // Add a lifetime parameter --------------------------------------------------- | |
c295e0f8 | 464 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
465 | enum EnumAddLifetimeParameter<'a> { |
466 | Variant1(&'a u32), | |
467 | Variant2(&'a u32), | |
468 | } | |
469 | ||
c295e0f8 | 470 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 | 471 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,type_of")] |
abe05a73 | 472 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
473 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,type_of")] |
474 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
475 | enum EnumAddLifetimeParameter<'a, 'b> { |
476 | Variant1(&'a u32), | |
477 | Variant2(&'b u32), | |
478 | } | |
479 | ||
480 | ||
481 | ||
482 | // Add a lifetime bound to a lifetime parameter ------------------------------- | |
c295e0f8 | 483 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
484 | enum EnumAddLifetimeParameterBound<'a, 'b> { |
485 | Variant1(&'a u32), | |
486 | Variant2(&'b u32), | |
487 | } | |
488 | ||
c295e0f8 | 489 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 | 490 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")] |
abe05a73 | 491 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
492 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")] |
493 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
494 | enum EnumAddLifetimeParameterBound<'a, 'b: 'a> { |
495 | Variant1(&'a u32), | |
496 | Variant2(&'b u32), | |
497 | } | |
498 | ||
499 | // Add a lifetime bound to a type parameter ----------------------------------- | |
c295e0f8 | 500 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
501 | enum EnumAddLifetimeBoundToParameter<'a, T> { |
502 | Variant1(T), | |
503 | Variant2(&'a u32), | |
504 | } | |
505 | ||
c295e0f8 | 506 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 | 507 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of")] |
abe05a73 | 508 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
509 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of")] |
510 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
511 | enum EnumAddLifetimeBoundToParameter<'a, T: 'a> { |
512 | Variant1(T), | |
513 | Variant2(&'a u32), | |
514 | } | |
515 | ||
516 | ||
517 | ||
518 | // Add a trait bound to a type parameter -------------------------------------- | |
c295e0f8 | 519 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
520 | enum EnumAddTraitBound<S> { |
521 | Variant1(S), | |
522 | } | |
523 | ||
c295e0f8 | 524 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 | 525 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")] |
abe05a73 | 526 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
527 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")] |
528 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
529 | enum EnumAddTraitBound<T: Sync> { |
530 | Variant1(T), | |
531 | } | |
532 | ||
533 | ||
534 | ||
535 | // Add a lifetime bound to a lifetime parameter in where clause --------------- | |
c295e0f8 | 536 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
537 | enum EnumAddLifetimeParameterBoundWhere<'a, 'b> { |
538 | Variant1(&'a u32), | |
539 | Variant2(&'b u32), | |
540 | } | |
541 | ||
c295e0f8 | 542 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 | 543 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")] |
abe05a73 | 544 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
545 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")] |
546 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
547 | enum EnumAddLifetimeParameterBoundWhere<'a, 'b> where 'b: 'a { |
548 | Variant1(&'a u32), | |
549 | Variant2(&'b u32), | |
550 | } | |
551 | ||
552 | ||
553 | ||
554 | // Add a lifetime bound to a type parameter in where clause ------------------- | |
c295e0f8 | 555 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
556 | enum EnumAddLifetimeBoundToParameterWhere<'a, T> { |
557 | Variant1(T), | |
558 | Variant2(&'a u32), | |
559 | } | |
560 | ||
c295e0f8 | 561 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 | 562 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of")] |
abe05a73 | 563 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
564 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of")] |
565 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
566 | enum EnumAddLifetimeBoundToParameterWhere<'a, T> where T: 'a { |
567 | Variant1(T), | |
568 | Variant2(&'a u32), | |
569 | } | |
570 | ||
571 | ||
572 | ||
573 | // Add a trait bound to a type parameter in where clause ---------------------- | |
c295e0f8 | 574 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
575 | enum EnumAddTraitBoundWhere<S> { |
576 | Variant1(S), | |
577 | } | |
578 | ||
c295e0f8 | 579 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 | 580 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")] |
abe05a73 | 581 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
582 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")] |
583 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
584 | enum EnumAddTraitBoundWhere<T> where T: Sync { |
585 | Variant1(T), | |
586 | } | |
587 | ||
588 | ||
589 | ||
590 | // In an enum with two variants, swap usage of type parameters ---------------- | |
c295e0f8 | 591 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
592 | enum EnumSwapUsageTypeParameters<A, B> { |
593 | Variant1 { a: A }, | |
594 | Variant2 { a: B }, | |
595 | } | |
596 | ||
c295e0f8 | 597 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 598 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] |
abe05a73 | 599 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
600 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")] |
601 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 | 602 | enum EnumSwapUsageTypeParameters<A, B> { |
cc61c64b | 603 | Variant1 { |
cc61c64b XL |
604 | a: B |
605 | }, | |
cc61c64b | 606 | Variant2 { |
cc61c64b XL |
607 | a: A |
608 | }, | |
c30ab7b3 SL |
609 | } |
610 | ||
611 | ||
612 | ||
613 | // In an enum with two variants, swap usage of lifetime parameters ------------ | |
c295e0f8 | 614 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 SL |
615 | enum EnumSwapUsageLifetimeParameters<'a, 'b> { |
616 | Variant1 { a: &'a u32 }, | |
617 | Variant2 { b: &'b u32 }, | |
618 | } | |
619 | ||
c295e0f8 | 620 | #[cfg(not(any(cfail1,cfail4)))] |
ba9703b0 | 621 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] |
abe05a73 | 622 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
623 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")] |
624 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 | 625 | enum EnumSwapUsageLifetimeParameters<'a, 'b> { |
cc61c64b | 626 | Variant1 { |
cc61c64b XL |
627 | a: &'b u32 |
628 | }, | |
cc61c64b | 629 | Variant2 { |
cc61c64b XL |
630 | b: &'a u32 |
631 | }, | |
c30ab7b3 SL |
632 | } |
633 | ||
634 | ||
635 | ||
636 | struct ReferencedType1; | |
637 | struct ReferencedType2; | |
638 | ||
639 | ||
640 | ||
641 | // Change field type in tuple-style variant indirectly by modifying a use statement | |
642 | mod change_field_type_indirectly_tuple_style { | |
c295e0f8 | 643 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 | 644 | use super::ReferencedType1 as FieldType; |
c295e0f8 | 645 | #[cfg(not(any(cfail1,cfail4)))] |
c30ab7b3 SL |
646 | use super::ReferencedType2 as FieldType; |
647 | ||
ba9703b0 | 648 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] |
abe05a73 | 649 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
650 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")] |
651 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 | 652 | enum TupleStyle { |
cc61c64b | 653 | Variant1( |
cc61c64b XL |
654 | FieldType |
655 | ) | |
c30ab7b3 SL |
656 | } |
657 | } | |
658 | ||
659 | ||
660 | ||
661 | // Change field type in record-style variant indirectly by modifying a use statement | |
662 | mod change_field_type_indirectly_struct_style { | |
c295e0f8 | 663 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 | 664 | use super::ReferencedType1 as FieldType; |
c295e0f8 | 665 | #[cfg(not(any(cfail1,cfail4)))] |
c30ab7b3 SL |
666 | use super::ReferencedType2 as FieldType; |
667 | ||
ba9703b0 | 668 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] |
abe05a73 | 669 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
670 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")] |
671 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 | 672 | enum StructStyle { |
cc61c64b | 673 | Variant1 { |
cc61c64b XL |
674 | a: FieldType |
675 | } | |
c30ab7b3 SL |
676 | } |
677 | } | |
678 | ||
679 | ||
680 | ||
681 | trait ReferencedTrait1 {} | |
682 | trait ReferencedTrait2 {} | |
683 | ||
684 | ||
685 | ||
686 | // Change trait bound of type parameter indirectly by modifying a use statement | |
687 | mod change_trait_bound_indirectly { | |
c295e0f8 | 688 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 | 689 | use super::ReferencedTrait1 as Trait; |
c295e0f8 | 690 | #[cfg(not(any(cfail1,cfail4)))] |
c30ab7b3 SL |
691 | use super::ReferencedTrait2 as Trait; |
692 | ||
ba9703b0 | 693 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")] |
abe05a73 | 694 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
695 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")] |
696 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
697 | enum Enum<T: Trait> { |
698 | Variant1(T) | |
699 | } | |
700 | } | |
701 | ||
702 | ||
703 | ||
704 | // Change trait bound of type parameter in where clause indirectly by modifying a use statement | |
705 | mod change_trait_bound_indirectly_where { | |
c295e0f8 | 706 | #[cfg(any(cfail1,cfail4))] |
c30ab7b3 | 707 | use super::ReferencedTrait1 as Trait; |
c295e0f8 | 708 | #[cfg(not(any(cfail1,cfail4)))] |
c30ab7b3 SL |
709 | use super::ReferencedTrait2 as Trait; |
710 | ||
ba9703b0 | 711 | #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")] |
abe05a73 | 712 | #[rustc_clean(cfg="cfail3")] |
c295e0f8 XL |
713 | #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")] |
714 | #[rustc_clean(cfg="cfail6")] | |
c30ab7b3 SL |
715 | enum Enum<T> where T: Trait { |
716 | Variant1(T) | |
717 | } | |
718 | } |