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 function and method call expressions.
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
25 #![feature(rustc_attrs)]
28 fn callee1(_x: u32, _y: i64) {}
29 fn callee2(_x: u32, _y: i64) {}
32 // Change Callee (Function) ----------------------------------------------------
34 pub fn change_callee_function() {
39 #[rustc_dirty(label="Hir", cfg="cfail2")]
40 #[rustc_clean(label="Hir", cfg="cfail3")]
41 #[rustc_metadata_dirty(cfg="cfail2")]
42 #[rustc_metadata_clean(cfg="cfail3")]
43 pub fn change_callee_function() {
49 // Change Argument (Function) --------------------------------------------------
51 pub fn change_argument_function() {
56 #[rustc_dirty(label="Hir", cfg="cfail2")]
57 #[rustc_clean(label="Hir", cfg="cfail3")]
58 #[rustc_metadata_dirty(cfg="cfail2")]
59 #[rustc_metadata_clean(cfg="cfail3")]
60 pub fn change_argument_function() {
66 // Change Callee Indirectly (Function) -----------------------------------------
67 mod change_callee_indirectly_function {
69 use super::callee1 as callee;
71 use super::callee2 as callee;
73 #[rustc_dirty(label="Hir", cfg="cfail2")]
74 #[rustc_clean(label="Hir", cfg="cfail3")]
75 #[rustc_metadata_dirty(cfg="cfail2")]
76 #[rustc_metadata_clean(cfg="cfail3")]
77 pub fn change_callee_indirectly_function() {
85 fn method1(&self, _x: char, _y: bool) {}
86 fn method2(&self, _x: char, _y: bool) {}
89 // Change Callee (Method) ------------------------------------------------------
91 pub fn change_callee_method() {
97 #[rustc_dirty(label="Hir", cfg="cfail2")]
98 #[rustc_clean(label="Hir", cfg="cfail3")]
99 #[rustc_metadata_dirty(cfg="cfail2")]
100 #[rustc_metadata_clean(cfg="cfail3")]
101 pub fn change_callee_method() {
103 s.method2('x', true);
108 // Change Argument (Method) ----------------------------------------------------
110 pub fn change_argument_method() {
112 s.method1('x', true);
116 #[rustc_dirty(label="Hir", cfg="cfail2")]
117 #[rustc_clean(label="Hir", cfg="cfail3")]
118 #[rustc_metadata_dirty(cfg="cfail2")]
119 #[rustc_metadata_clean(cfg="cfail3")]
120 pub fn change_argument_method() {
122 s.method1('y', true);
127 // Change Callee (Method, UFCS) ------------------------------------------------
129 pub fn change_ufcs_callee_method() {
131 Struct::method1(&s, 'x', true);
135 #[rustc_dirty(label="Hir", cfg="cfail2")]
136 #[rustc_clean(label="Hir", cfg="cfail3")]
137 #[rustc_metadata_dirty(cfg="cfail2")]
138 #[rustc_metadata_clean(cfg="cfail3")]
139 pub fn change_ufcs_callee_method() {
141 Struct::method2(&s, 'x', true);
146 // Change Argument (Method, UFCS) ----------------------------------------------
148 pub fn change_argument_method_ufcs() {
150 Struct::method1(&s, 'x', true);
154 #[rustc_dirty(label="Hir", cfg="cfail2")]
155 #[rustc_clean(label="Hir", cfg="cfail3")]
156 #[rustc_metadata_dirty(cfg="cfail2")]
157 #[rustc_metadata_clean(cfg="cfail3")]
158 pub fn change_argument_method_ufcs() {
160 Struct::method1(&s, 'x', false);
165 // Change To UFCS --------------------------------------------------------------
167 pub fn change_to_ufcs() {
169 s.method1('x', true);
173 #[rustc_dirty(label="Hir", cfg="cfail2")]
174 #[rustc_clean(label="Hir", cfg="cfail3")]
175 #[rustc_metadata_dirty(cfg="cfail2")]
176 #[rustc_metadata_clean(cfg="cfail3")]
177 pub fn change_to_ufcs() {
179 Struct::method1(&s, 'x', true);
185 fn method1(&self, _x: char, _y: bool) {}
188 // Change UFCS Callee Indirectly -----------------------------------------------
189 mod change_ufcs_callee_indirectly {
191 use super::Struct as Struct;
193 use super::Struct2 as Struct;
195 #[rustc_dirty(label="Hir", cfg="cfail2")]
196 #[rustc_clean(label="Hir", cfg="cfail3")]
197 #[rustc_metadata_dirty(cfg="cfail2")]
198 #[rustc_metadata_clean(cfg="cfail3")]
199 pub fn change_ufcs_callee_indirectly() {
201 Struct::method1(&s, 'q', false)