]> git.proxmox.com Git - rustc.git/blame - src/test/incremental/hashes/indexing_expressions.rs
New upstream version 1.56.0+dfsg1
[rustc.git] / src / test / incremental / hashes / indexing_expressions.rs
CommitLineData
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?)
476ff2be 9// revisions: cfail1 cfail2 cfail3
ff7c6d11 10// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
476ff2be
SL
11
12#![allow(warnings)]
13#![feature(rustc_attrs)]
14#![crate_type="rlib"]
476ff2be 15
e1599b0c 16// Change simple index
476ff2be
SL
17#[cfg(cfail1)]
18fn change_simple_index(slice: &[u32]) -> u32 {
19 slice[3]
20}
21
22#[cfg(not(cfail1))]
17df50a5
XL
23#[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
24#[rustc_clean(cfg="cfail3")]
476ff2be
SL
25fn change_simple_index(slice: &[u32]) -> u32 {
26 slice[4]
27}
28
29
30
e1599b0c 31// Change lower bound
476ff2be
SL
32#[cfg(cfail1)]
33fn change_lower_bound(slice: &[u32]) -> &[u32] {
34 &slice[3..5]
35}
36
37#[cfg(not(cfail1))]
17df50a5
XL
38#[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
39#[rustc_clean(cfg="cfail3")]
476ff2be
SL
40fn change_lower_bound(slice: &[u32]) -> &[u32] {
41 &slice[2..5]
42}
43
44
45
e1599b0c 46// Change upper bound
476ff2be
SL
47#[cfg(cfail1)]
48fn change_upper_bound(slice: &[u32]) -> &[u32] {
49 &slice[3..5]
50}
51
52#[cfg(not(cfail1))]
17df50a5
XL
53#[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
54#[rustc_clean(cfg="cfail3")]
476ff2be
SL
55fn change_upper_bound(slice: &[u32]) -> &[u32] {
56 &slice[3..7]
57}
58
59
60
e1599b0c 61// Add lower bound
476ff2be
SL
62#[cfg(cfail1)]
63fn add_lower_bound(slice: &[u32]) -> &[u32] {
64 &slice[..4]
65}
66
67#[cfg(not(cfail1))]
17df50a5
XL
68#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
69#[rustc_clean(cfg="cfail3")]
476ff2be
SL
70fn add_lower_bound(slice: &[u32]) -> &[u32] {
71 &slice[3..4]
72}
73
74
75
e1599b0c 76// Add upper bound
476ff2be
SL
77#[cfg(cfail1)]
78fn add_upper_bound(slice: &[u32]) -> &[u32] {
79 &slice[3..]
80}
81
82#[cfg(not(cfail1))]
17df50a5
XL
83#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
84#[rustc_clean(cfg="cfail3")]
476ff2be
SL
85fn add_upper_bound(slice: &[u32]) -> &[u32] {
86 &slice[3..7]
87}
88
89
90
e1599b0c 91// Change mutability
476ff2be
SL
92#[cfg(cfail1)]
93fn change_mutability(slice: &mut [u32]) -> u32 {
94 (&mut slice[3..5])[0]
95}
96
97#[cfg(not(cfail1))]
17df50a5
XL
98#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
99#[rustc_clean(cfg="cfail3")]
476ff2be
SL
100fn change_mutability(slice: &mut [u32]) -> u32 {
101 (&slice[3..5])[0]
102}
103
104
105
e1599b0c 106// Exclusive to inclusive range
476ff2be
SL
107#[cfg(cfail1)]
108fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] {
109 &slice[3..7]
110}
111
112#[cfg(not(cfail1))]
17df50a5
XL
113#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
114#[rustc_clean(cfg="cfail3")]
476ff2be 115fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] {
ea8adc8c 116 &slice[3..=7]
476ff2be 117}