1 // Copyright 2014 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.
11 // Test where we change the body of a private method in an impl.
12 // We then test what sort of functions must be rebuilt as a result.
14 // revisions:rpass1 rpass2
15 // compile-flags: -Z query-dep-graph
18 #![feature(rustc_attrs)]
19 #![feature(stmt_expr_attributes)]
22 #![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="rpass2")]
23 #![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="rpass2")]
24 #![rustc_partition_reused(module="struct_point-fn_read_field", cfg="rpass2")]
25 #![rustc_partition_reused(module="struct_point-fn_write_field", cfg="rpass2")]
26 #![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="rpass2")]
30 /// A fn item that calls (public) methods on `Point` from the same impl which changed
31 mod fn_calls_methods_in_same_impl {
34 #[rustc_clean(label="TypeckTables", cfg="rpass2")]
36 let x = Point { x: 2.0, y: 2.0 };
37 x.distance_from_origin();
41 /// A fn item that calls (public) methods on `Point` from another impl
42 mod fn_calls_methods_in_another_impl {
45 #[rustc_clean(label="TypeckTables", cfg="rpass2")]
47 let mut x = Point { x: 2.0, y: 2.0 };
48 x.translate(3.0, 3.0);
52 /// A fn item that makes an instance of `Point` but does not invoke methods
56 #[rustc_clean(label="TypeckTables", cfg="rpass2")]
57 pub fn make_origin() -> Point {
58 Point { x: 2.0, y: 2.0 }
62 /// A fn item that reads fields from `Point` but does not invoke methods
66 #[rustc_clean(label="TypeckTables", cfg="rpass2")]
67 pub fn get_x(p: Point) -> f32 {
72 /// A fn item that writes to a field of `Point` but does not invoke methods
76 #[rustc_clean(label="TypeckTables", cfg="rpass2")]
77 pub fn inc_x(p: &mut Point) {