]>
git.proxmox.com Git - rustc.git/blob - src/test/incremental/hashes/indexing_expressions.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
12 // This test case tests the incremental compilation hash (ICH) implementation
13 // for indexing expression.
15 // The general pattern followed here is: Change one thing between rev1 and rev2
16 // and make sure that the hash has changed, then change nothing between rev2 and
17 // rev3 and make sure that the hash has not changed.
19 // must-compile-successfully
20 // revisions: cfail1 cfail2 cfail3
21 // compile-flags: -Z query-dep-graph
24 #![feature(rustc_attrs)]
26 #![feature(inclusive_range_syntax)]
28 // Change simple index ---------------------------------------------------------
30 fn change_simple_index(slice
: &[u32]) -> u32 {
35 #[rustc_clean(label="Hir", cfg="cfail2")]
36 #[rustc_clean(label="Hir", cfg="cfail3")]
37 #[rustc_dirty(label="HirBody", cfg="cfail2")]
38 #[rustc_clean(label="HirBody", cfg="cfail3")]
39 #[rustc_metadata_clean(cfg="cfail2")]
40 #[rustc_metadata_clean(cfg="cfail3")]
41 fn change_simple_index(slice
: &[u32]) -> u32 {
47 // Change lower bound ----------------------------------------------------------
49 fn change_lower_bound(slice
: &[u32]) -> &[u32] {
54 #[rustc_clean(label="Hir", cfg="cfail2")]
55 #[rustc_clean(label="Hir", cfg="cfail3")]
56 #[rustc_dirty(label="HirBody", cfg="cfail2")]
57 #[rustc_clean(label="HirBody", cfg="cfail3")]
58 #[rustc_metadata_clean(cfg="cfail2")]
59 #[rustc_metadata_clean(cfg="cfail3")]
60 fn change_lower_bound(slice
: &[u32]) -> &[u32] {
66 // Change upper bound ----------------------------------------------------------
68 fn change_upper_bound(slice
: &[u32]) -> &[u32] {
73 #[rustc_clean(label="Hir", cfg="cfail2")]
74 #[rustc_clean(label="Hir", cfg="cfail3")]
75 #[rustc_dirty(label="HirBody", cfg="cfail2")]
76 #[rustc_clean(label="HirBody", cfg="cfail3")]
77 #[rustc_metadata_clean(cfg="cfail2")]
78 #[rustc_metadata_clean(cfg="cfail3")]
79 fn change_upper_bound(slice
: &[u32]) -> &[u32] {
85 // Add lower bound -------------------------------------------------------------
87 fn add_lower_bound(slice
: &[u32]) -> &[u32] {
92 #[rustc_clean(label="Hir", cfg="cfail2")]
93 #[rustc_clean(label="Hir", cfg="cfail3")]
94 #[rustc_dirty(label="HirBody", cfg="cfail2")]
95 #[rustc_clean(label="HirBody", cfg="cfail3")]
96 #[rustc_metadata_clean(cfg="cfail2")]
97 #[rustc_metadata_clean(cfg="cfail3")]
98 fn add_lower_bound(slice
: &[u32]) -> &[u32] {
104 // Add upper bound -------------------------------------------------------------
106 fn add_upper_bound(slice
: &[u32]) -> &[u32] {
111 #[rustc_clean(label="Hir", cfg="cfail2")]
112 #[rustc_clean(label="Hir", cfg="cfail3")]
113 #[rustc_dirty(label="HirBody", cfg="cfail2")]
114 #[rustc_clean(label="HirBody", cfg="cfail3")]
115 #[rustc_metadata_clean(cfg="cfail2")]
116 #[rustc_metadata_clean(cfg="cfail3")]
117 fn add_upper_bound(slice
: &[u32]) -> &[u32] {
123 // Change mutability -----------------------------------------------------------
125 fn change_mutability(slice
: &mut [u32]) -> u32 {
126 (&mut slice
[3..5])[0]
130 #[rustc_clean(label="Hir", cfg="cfail2")]
131 #[rustc_clean(label="Hir", cfg="cfail3")]
132 #[rustc_dirty(label="HirBody", cfg="cfail2")]
133 #[rustc_clean(label="HirBody", cfg="cfail3")]
134 #[rustc_metadata_clean(cfg="cfail2")]
135 #[rustc_metadata_clean(cfg="cfail3")]
136 fn change_mutability(slice
: &mut [u32]) -> u32 {
142 // Exclusive to inclusive range ------------------------------------------------
144 fn exclusive_to_inclusive_range(slice
: &[u32]) -> &[u32] {
149 #[rustc_clean(label="Hir", cfg="cfail2")]
150 #[rustc_clean(label="Hir", cfg="cfail3")]
151 #[rustc_dirty(label="HirBody", cfg="cfail2")]
152 #[rustc_clean(label="HirBody", cfg="cfail3")]
153 #[rustc_metadata_clean(cfg="cfail2")]
154 #[rustc_metadata_clean(cfg="cfail3")]
155 fn exclusive_to_inclusive_range(slice
: &[u32]) -> &[u32] {