1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for indexing expression.
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.
8 // build-pass (FIXME(62277): could be check-pass?)
9 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
10 // compile-flags: -Z query-dep-graph -O
11 // [cfail1]compile-flags: -Zincremental-ignore-spans
12 // [cfail2]compile-flags: -Zincremental-ignore-spans
13 // [cfail3]compile-flags: -Zincremental-ignore-spans
14 // [cfail4]compile-flags: -Zincremental-relative-spans
15 // [cfail5]compile-flags: -Zincremental-relative-spans
16 // [cfail6]compile-flags: -Zincremental-relative-spans
19 #![feature(rustc_attrs)]
22 // Change simple index
23 #[cfg(any(cfail1,cfail4))]
24 fn change_simple_index(slice: &[u32]) -> u32 {
28 #[cfg(not(any(cfail1,cfail4)))]
29 #[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
30 #[rustc_clean(cfg="cfail3")]
31 #[rustc_clean(except="hir_owner_nodes", cfg="cfail5")]
32 #[rustc_clean(cfg="cfail6")]
33 fn change_simple_index(slice: &[u32]) -> u32 {
40 #[cfg(any(cfail1,cfail4))]
41 fn change_lower_bound(slice: &[u32]) -> &[u32] {
45 #[cfg(not(any(cfail1,cfail4)))]
46 #[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
47 #[rustc_clean(cfg="cfail3")]
48 #[rustc_clean(except="hir_owner_nodes", cfg="cfail5")]
49 #[rustc_clean(cfg="cfail6")]
50 fn change_lower_bound(slice: &[u32]) -> &[u32] {
57 #[cfg(any(cfail1,cfail4))]
58 fn change_upper_bound(slice: &[u32]) -> &[u32] {
62 #[cfg(not(any(cfail1,cfail4)))]
63 #[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
64 #[rustc_clean(cfg="cfail3")]
65 #[rustc_clean(except="hir_owner_nodes", cfg="cfail5")]
66 #[rustc_clean(cfg="cfail6")]
67 fn change_upper_bound(slice: &[u32]) -> &[u32] {
74 #[cfg(any(cfail1,cfail4))]
75 fn add_lower_bound(slice: &[u32]) -> &[u32] {
79 #[cfg(not(any(cfail1,cfail4)))]
80 #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck", cfg="cfail2")]
81 #[rustc_clean(cfg="cfail3")]
82 #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck", cfg="cfail5")]
83 #[rustc_clean(cfg="cfail6")]
84 fn add_lower_bound(slice: &[u32]) -> &[u32] {
91 #[cfg(any(cfail1,cfail4))]
92 fn add_upper_bound(slice: &[u32]) -> &[u32] {
96 #[cfg(not(any(cfail1,cfail4)))]
97 #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck", cfg="cfail2")]
98 #[rustc_clean(cfg="cfail3")]
99 #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck", cfg="cfail5")]
100 #[rustc_clean(cfg="cfail6")]
101 fn add_upper_bound(slice: &[u32]) -> &[u32] {
108 #[cfg(any(cfail1,cfail4))]
109 fn change_mutability(slice: &mut [u32]) -> u32 {
110 (&mut slice[3..5])[0]
113 #[cfg(not(any(cfail1,cfail4)))]
114 #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
115 #[rustc_clean(cfg="cfail3")]
116 #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
117 #[rustc_clean(cfg="cfail6")]
118 fn change_mutability(slice: &mut [u32]) -> u32 {
124 // Exclusive to inclusive range
125 #[cfg(any(cfail1,cfail4))]
126 fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] {
130 #[cfg(not(any(cfail1,cfail4)))]
131 #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck", cfg="cfail2")]
132 #[rustc_clean(cfg="cfail3")]
133 #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck", cfg="cfail5")]
134 #[rustc_clean(cfg="cfail6")]
135 fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] {