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