]> git.proxmox.com Git - rustc.git/blob - src/test/ui/traits/vtable/vtable-multi-level.rs
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / test / ui / traits / vtable / vtable-multi-level.rs
1 // build-fail
2 #![feature(rustc_attrs)]
3
4 // O --> G --> C --> A
5 // \ \ \-> B
6 // | |-> F --> D
7 // | \-> E
8 // |-> N --> J --> H
9 // \ \-> I
10 // |-> M --> K
11 // \-> L
12
13 #[rustc_dump_vtable]
14 trait A {
15 fn foo_a(&self) {}
16 }
17
18 #[rustc_dump_vtable]
19 trait B {
20 //~^ error Vtable
21 fn foo_b(&self) {}
22 }
23
24 #[rustc_dump_vtable]
25 trait C: A + B {
26 fn foo_c(&self) {}
27 }
28
29 #[rustc_dump_vtable]
30 trait D {
31 //~^ error Vtable
32 fn foo_d(&self) {}
33 }
34
35 #[rustc_dump_vtable]
36 trait E {
37 //~^ error Vtable
38 fn foo_e(&self) {}
39 }
40
41 #[rustc_dump_vtable]
42 trait F: D + E {
43 //~^ error Vtable
44 fn foo_f(&self) {}
45 }
46
47 #[rustc_dump_vtable]
48 trait G: C + F {
49 fn foo_g(&self) {}
50 }
51
52 #[rustc_dump_vtable]
53 trait H {
54 //~^ error Vtable
55 fn foo_h(&self) {}
56 }
57
58 #[rustc_dump_vtable]
59 trait I {
60 //~^ error Vtable
61 fn foo_i(&self) {}
62 }
63
64 #[rustc_dump_vtable]
65 trait J: H + I {
66 //~^ error Vtable
67 fn foo_j(&self) {}
68 }
69
70 #[rustc_dump_vtable]
71 trait K {
72 //~^ error Vtable
73 fn foo_k(&self) {}
74 }
75
76 #[rustc_dump_vtable]
77 trait L {
78 //~^ error Vtable
79 fn foo_l(&self) {}
80 }
81
82 #[rustc_dump_vtable]
83 trait M: K + L {
84 //~^ error Vtable
85 fn foo_m(&self) {}
86 }
87
88 #[rustc_dump_vtable]
89 trait N: J + M {
90 //~^ error Vtable
91 fn foo_n(&self) {}
92 }
93
94 #[rustc_dump_vtable]
95 trait O: G + N {
96 //~^ error Vtable
97 fn foo_o(&self) {}
98 }
99
100 struct S;
101
102 impl A for S {}
103 impl B for S {}
104 impl C for S {}
105 impl D for S {}
106 impl E for S {}
107 impl F for S {}
108 impl G for S {}
109 impl H for S {}
110 impl I for S {}
111 impl J for S {}
112 impl K for S {}
113 impl L for S {}
114 impl M for S {}
115 impl N for S {}
116 impl O for S {}
117
118 fn foo(_: &dyn O) {}
119
120 fn main() {
121 foo(&S);
122 }