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 add a private item into the root of an external.
12 // crate. This should not cause anything we use to be invalidated.
13 // Regression test for #36168.
15 // revisions:rpass1 rpass2
16 // compile-flags: -Z query-dep-graph
18 // ignore-test FIXME(#42293) this regressed in #44142 but should get fixed with red/green
20 #![feature(rustc_attrs)]
21 #![feature(stmt_expr_attributes)]
24 #![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="rpass2")]
25 #![rustc_partition_reused(module="struct_point-fn_calls_free_fn", cfg="rpass2")]
26 #![rustc_partition_reused(module="struct_point-fn_read_field", cfg="rpass2")]
27 #![rustc_partition_reused(module="struct_point-fn_write_field", cfg="rpass2")]
28 #![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="rpass2")]
32 /// A fn item that calls (public) methods on `Point` from the same impl
33 mod fn_calls_methods_in_same_impl {
36 #[rustc_clean(label="TypeckTables", cfg="rpass2")]
38 let x = Point { x: 2.0, y: 2.0 };
39 x.distance_from_origin();
43 /// A fn item that calls (public) methods on `Point` from another impl
44 mod fn_calls_free_fn {
45 use point::{self, Point};
47 #[rustc_clean(label="TypeckTables", cfg="rpass2")]
49 let x = Point { x: 2.0, y: 2.0 };
50 point::distance_squared(&x);
54 /// A fn item that makes an instance of `Point` but does not invoke methods
58 #[rustc_clean(label="TypeckTables", cfg="rpass2")]
59 pub fn make_origin() -> Point {
60 Point { x: 2.0, y: 2.0 }
64 /// A fn item that reads fields from `Point` but does not invoke methods
68 #[rustc_clean(label="TypeckTables", cfg="rpass2")]
69 pub fn get_x(p: Point) -> f32 {
74 /// A fn item that writes to a field of `Point` but does not invoke methods
78 #[rustc_clean(label="TypeckTables", cfg="rpass2")]
79 pub fn inc_x(p: &mut Point) {