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