]>
Commit | Line | Data |
---|---|---|
476ff2be | 1 | // This test case tests the incremental compilation hash (ICH) implementation |
abe05a73 | 2 | // for indexing expression. |
476ff2be SL |
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 | ||
416331ca | 8 | // build-pass (FIXME(62277): could be check-pass?) |
c295e0f8 | 9 | // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 |
923072b8 | 10 | // compile-flags: -Z query-dep-graph -O |
c295e0f8 XL |
11 | // [cfail1]compile-flags: -Zincremental-ignore-spans |
12 | // [cfail2]compile-flags: -Zincremental-ignore-spans | |
13 | // [cfail3]compile-flags: -Zincremental-ignore-spans | |
476ff2be SL |
14 | |
15 | #![allow(warnings)] | |
16 | #![feature(rustc_attrs)] | |
17 | #![crate_type="rlib"] | |
476ff2be | 18 | |
e1599b0c | 19 | // Change simple index |
c295e0f8 | 20 | #[cfg(any(cfail1,cfail4))] |
476ff2be SL |
21 | fn change_simple_index(slice: &[u32]) -> u32 { |
22 | slice[3] | |
23 | } | |
24 | ||
c295e0f8 | 25 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 XL |
26 | #[rustc_clean(except="hir_owner_nodes", cfg="cfail2")] |
27 | #[rustc_clean(cfg="cfail3")] | |
c295e0f8 XL |
28 | #[rustc_clean(except="hir_owner_nodes", cfg="cfail5")] |
29 | #[rustc_clean(cfg="cfail6")] | |
476ff2be SL |
30 | fn change_simple_index(slice: &[u32]) -> u32 { |
31 | slice[4] | |
32 | } | |
33 | ||
34 | ||
35 | ||
e1599b0c | 36 | // Change lower bound |
c295e0f8 | 37 | #[cfg(any(cfail1,cfail4))] |
476ff2be SL |
38 | fn change_lower_bound(slice: &[u32]) -> &[u32] { |
39 | &slice[3..5] | |
40 | } | |
41 | ||
c295e0f8 | 42 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 XL |
43 | #[rustc_clean(except="hir_owner_nodes", cfg="cfail2")] |
44 | #[rustc_clean(cfg="cfail3")] | |
c295e0f8 XL |
45 | #[rustc_clean(except="hir_owner_nodes", cfg="cfail5")] |
46 | #[rustc_clean(cfg="cfail6")] | |
476ff2be SL |
47 | fn change_lower_bound(slice: &[u32]) -> &[u32] { |
48 | &slice[2..5] | |
49 | } | |
50 | ||
51 | ||
52 | ||
e1599b0c | 53 | // Change upper bound |
c295e0f8 | 54 | #[cfg(any(cfail1,cfail4))] |
476ff2be SL |
55 | fn change_upper_bound(slice: &[u32]) -> &[u32] { |
56 | &slice[3..5] | |
57 | } | |
58 | ||
c295e0f8 | 59 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 XL |
60 | #[rustc_clean(except="hir_owner_nodes", cfg="cfail2")] |
61 | #[rustc_clean(cfg="cfail3")] | |
c295e0f8 XL |
62 | #[rustc_clean(except="hir_owner_nodes", cfg="cfail5")] |
63 | #[rustc_clean(cfg="cfail6")] | |
476ff2be SL |
64 | fn change_upper_bound(slice: &[u32]) -> &[u32] { |
65 | &slice[3..7] | |
66 | } | |
67 | ||
68 | ||
69 | ||
e1599b0c | 70 | // Add lower bound |
c295e0f8 | 71 | #[cfg(any(cfail1,cfail4))] |
476ff2be | 72 | fn add_lower_bound(slice: &[u32]) -> &[u32] { |
c295e0f8 | 73 | &slice[ ..4] |
476ff2be SL |
74 | } |
75 | ||
c295e0f8 | 76 | #[cfg(not(any(cfail1,cfail4)))] |
5e7ed085 | 77 | #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck", cfg="cfail2")] |
17df50a5 | 78 | #[rustc_clean(cfg="cfail3")] |
5e7ed085 | 79 | #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck", cfg="cfail5")] |
c295e0f8 | 80 | #[rustc_clean(cfg="cfail6")] |
476ff2be SL |
81 | fn add_lower_bound(slice: &[u32]) -> &[u32] { |
82 | &slice[3..4] | |
83 | } | |
84 | ||
85 | ||
86 | ||
e1599b0c | 87 | // Add upper bound |
c295e0f8 | 88 | #[cfg(any(cfail1,cfail4))] |
476ff2be | 89 | fn add_upper_bound(slice: &[u32]) -> &[u32] { |
c295e0f8 | 90 | &slice[3.. ] |
476ff2be SL |
91 | } |
92 | ||
c295e0f8 | 93 | #[cfg(not(any(cfail1,cfail4)))] |
5e7ed085 | 94 | #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck", cfg="cfail2")] |
17df50a5 | 95 | #[rustc_clean(cfg="cfail3")] |
5e7ed085 | 96 | #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck", cfg="cfail5")] |
c295e0f8 | 97 | #[rustc_clean(cfg="cfail6")] |
476ff2be SL |
98 | fn add_upper_bound(slice: &[u32]) -> &[u32] { |
99 | &slice[3..7] | |
100 | } | |
101 | ||
102 | ||
103 | ||
e1599b0c | 104 | // Change mutability |
c295e0f8 | 105 | #[cfg(any(cfail1,cfail4))] |
476ff2be SL |
106 | fn change_mutability(slice: &mut [u32]) -> u32 { |
107 | (&mut slice[3..5])[0] | |
108 | } | |
109 | ||
c295e0f8 | 110 | #[cfg(not(any(cfail1,cfail4)))] |
17df50a5 XL |
111 | #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")] |
112 | #[rustc_clean(cfg="cfail3")] | |
c295e0f8 XL |
113 | #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")] |
114 | #[rustc_clean(cfg="cfail6")] | |
476ff2be | 115 | fn change_mutability(slice: &mut [u32]) -> u32 { |
c295e0f8 | 116 | (& slice[3..5])[0] |
476ff2be SL |
117 | } |
118 | ||
119 | ||
120 | ||
e1599b0c | 121 | // Exclusive to inclusive range |
c295e0f8 | 122 | #[cfg(any(cfail1,cfail4))] |
476ff2be | 123 | fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] { |
c295e0f8 | 124 | &slice[3.. 7] |
476ff2be SL |
125 | } |
126 | ||
c295e0f8 | 127 | #[cfg(not(any(cfail1,cfail4)))] |
5e7ed085 | 128 | #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck", cfg="cfail2")] |
17df50a5 | 129 | #[rustc_clean(cfg="cfail3")] |
5e7ed085 | 130 | #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck", cfg="cfail5")] |
c295e0f8 | 131 | #[rustc_clean(cfg="cfail6")] |
476ff2be | 132 | fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] { |
ea8adc8c | 133 | &slice[3..=7] |
476ff2be | 134 | } |