]> git.proxmox.com Git - rustc.git/blame - 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
CommitLineData
9cc50fc6
SL
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
cdc7bbd5 4// compile-flags: -Z query-dep-graph -C incremental=tmp/dep-graph-trait-impl-two-traits-same-method
9cc50fc6
SL
5
6#![feature(rustc_attrs)]
7#![allow(dead_code)]
a7813a04 8#![allow(unused_imports)]
9cc50fc6
SL
9
10fn main() { }
11
12pub trait Foo: Sized {
13 fn method(self) { }
14}
15
16pub trait Bar: Sized {
17 fn method(self) { }
18}
19
20mod x {
21 use {Foo, Bar};
22
23 #[rustc_if_this_changed]
24 impl Foo for u32 { }
25
26 impl Bar for char { }
27}
28
29mod y {
30 use {Foo, Bar};
31
3dfed10e 32 #[rustc_then_this_would_need(typeck)] //~ ERROR OK
9cc50fc6
SL
33 pub fn with_char() {
34 char::method('a');
35 }
36}
37
38mod z {
39 use y;
40
3dfed10e 41 #[rustc_then_this_would_need(typeck)] //~ ERROR no path
9cc50fc6
SL
42 pub fn z() {
43 y::with_char();
44 }
45}