]>
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.
20 // revisions: cfail1 cfail2 cfail3
21 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
24 #![feature(rustc_attrs)]
27 // Change simple index ---------------------------------------------------------
29 fn change_simple_index(slice
: &[u32]) -> u32 {
34 #[rustc_clean(label="Hir", cfg="cfail2")]
35 #[rustc_clean(label="Hir", cfg="cfail3")]
36 #[rustc_dirty(label="HirBody", cfg="cfail2")]
37 #[rustc_clean(label="HirBody", cfg="cfail3")]
38 fn change_simple_index(slice
: &[u32]) -> u32 {
44 // Change lower bound ----------------------------------------------------------
46 fn change_lower_bound(slice
: &[u32]) -> &[u32] {
51 #[rustc_clean(label="Hir", cfg="cfail2")]
52 #[rustc_clean(label="Hir", cfg="cfail3")]
53 #[rustc_dirty(label="HirBody", cfg="cfail2")]
54 #[rustc_clean(label="HirBody", cfg="cfail3")]
55 fn change_lower_bound(slice
: &[u32]) -> &[u32] {
61 // Change upper bound ----------------------------------------------------------
63 fn change_upper_bound(slice
: &[u32]) -> &[u32] {
68 #[rustc_clean(label="Hir", cfg="cfail2")]
69 #[rustc_clean(label="Hir", cfg="cfail3")]
70 #[rustc_dirty(label="HirBody", cfg="cfail2")]
71 #[rustc_clean(label="HirBody", cfg="cfail3")]
72 fn change_upper_bound(slice
: &[u32]) -> &[u32] {
78 // Add lower bound -------------------------------------------------------------
80 fn add_lower_bound(slice
: &[u32]) -> &[u32] {
85 #[rustc_clean(label="Hir", cfg="cfail2")]
86 #[rustc_clean(label="Hir", cfg="cfail3")]
87 #[rustc_dirty(label="HirBody", cfg="cfail2")]
88 #[rustc_clean(label="HirBody", cfg="cfail3")]
89 fn add_lower_bound(slice
: &[u32]) -> &[u32] {
95 // Add upper bound -------------------------------------------------------------
97 fn add_upper_bound(slice
: &[u32]) -> &[u32] {
102 #[rustc_clean(label="Hir", cfg="cfail2")]
103 #[rustc_clean(label="Hir", cfg="cfail3")]
104 #[rustc_dirty(label="HirBody", cfg="cfail2")]
105 #[rustc_clean(label="HirBody", cfg="cfail3")]
106 fn add_upper_bound(slice
: &[u32]) -> &[u32] {
112 // Change mutability -----------------------------------------------------------
114 fn change_mutability(slice
: &mut [u32]) -> u32 {
115 (&mut slice
[3..5])[0]
119 #[rustc_clean(label="Hir", cfg="cfail2")]
120 #[rustc_clean(label="Hir", cfg="cfail3")]
121 #[rustc_dirty(label="HirBody", cfg="cfail2")]
122 #[rustc_clean(label="HirBody", cfg="cfail3")]
123 fn change_mutability(slice
: &mut [u32]) -> u32 {
129 // Exclusive to inclusive range ------------------------------------------------
131 fn exclusive_to_inclusive_range(slice
: &[u32]) -> &[u32] {
136 #[rustc_clean(label="Hir", cfg="cfail2")]
137 #[rustc_clean(label="Hir", cfg="cfail3")]
138 #[rustc_dirty(label="HirBody", cfg="cfail2")]
139 #[rustc_clean(label="HirBody", cfg="cfail3")]
140 fn exclusive_to_inclusive_range(slice
: &[u32]) -> &[u32] {