]> git.proxmox.com Git - rustc.git/blob - src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs
New upstream version 1.53.0+dfsg1
[rustc.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 // compile-flags: -Z query-dep-graph -C incremental=tmp/dep-graph-trait-impl-two-traits-same-method
5
6 #![feature(rustc_attrs)]
7 #![allow(dead_code)]
8 #![allow(unused_imports)]
9
10 fn main() { }
11
12 pub trait Foo: Sized {
13 fn method(self) { }
14 }
15
16 pub trait Bar: Sized {
17 fn method(self) { }
18 }
19
20 mod x {
21 use {Foo, Bar};
22
23 #[rustc_if_this_changed]
24 impl Foo for u32 { }
25
26 impl Bar for char { }
27 }
28
29 mod y {
30 use {Foo, Bar};
31
32 #[rustc_then_this_would_need(typeck)] //~ ERROR OK
33 pub fn with_char() {
34 char::method('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::with_char();
44 }
45 }