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