]> git.lizzy.rs Git - rust.git/blob - src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs
Auto merge of #99028 - tmiasko:inline, r=estebank
[rust.git] / src / test / ui / dep-graph / dep-graph-trait-impl-two-traits-same-method.rs
1 // Test that adding an impl to a trait `Foo` DOES affect functions
2 // that only use `Bar` if they have methods in common.
3
4 // incremental
5 // compile-flags: -Z query-dep-graph
6
7 #![feature(rustc_attrs)]
8 #![allow(dead_code)]
9 #![allow(unused_imports)]
10
11 fn main() { }
12
13 pub trait Foo: Sized {
14     fn method(self) { }
15 }
16
17 pub trait Bar: Sized {
18     fn method(self) { }
19 }
20
21 mod x {
22     use {Foo, Bar};
23
24     #[rustc_if_this_changed]
25     impl Foo for u32 { }
26
27     impl Bar for char { }
28 }
29
30 mod y {
31     use {Foo, Bar};
32
33     #[rustc_then_this_would_need(typeck)] //~ ERROR OK
34     pub fn with_char() {
35         char::method('a');
36     }
37 }
38
39 mod z {
40     use y;
41
42     #[rustc_then_this_would_need(typeck)] //~ ERROR no path
43     pub fn z() {
44         y::with_char();
45     }
46 }