summary refs log tree commit diff
path: root/src/test/ui/traits/vtable/vtable-multi-level.rs
blob: fcb5fd5274be420bd5dc6b6a2cfb3e4682e50b0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// build-fail
#![feature(rustc_attrs)]

//   O --> G --> C --> A
//     \     \     \-> B
//     |     |-> F --> D
//     |           \-> E
//     |-> N --> J --> H
//           \     \-> I
//           |-> M --> K
//                 \-> L

#[rustc_dump_vtable]
trait A {
    fn foo_a(&self) {}
}

#[rustc_dump_vtable]
trait B {
    //~^ error vtable
    fn foo_b(&self) {}
}

#[rustc_dump_vtable]
trait C: A + B {
    fn foo_c(&self) {}
}

#[rustc_dump_vtable]
trait D {
    //~^ error vtable
    fn foo_d(&self) {}
}

#[rustc_dump_vtable]
trait E {
    //~^ error vtable
    fn foo_e(&self) {}
}

#[rustc_dump_vtable]
trait F: D + E {
    //~^ error vtable
    fn foo_f(&self) {}
}

#[rustc_dump_vtable]
trait G: C + F {
    fn foo_g(&self) {}
}

#[rustc_dump_vtable]
trait H {
    //~^ error vtable
    fn foo_h(&self) {}
}

#[rustc_dump_vtable]
trait I {
    //~^ error vtable
    fn foo_i(&self) {}
}

#[rustc_dump_vtable]
trait J: H + I {
    //~^ error vtable
    fn foo_j(&self) {}
}

#[rustc_dump_vtable]
trait K {
    //~^ error vtable
    fn foo_k(&self) {}
}

#[rustc_dump_vtable]
trait L {
    //~^ error vtable
    fn foo_l(&self) {}
}

#[rustc_dump_vtable]
trait M: K + L {
    //~^ error vtable
    fn foo_m(&self) {}
}

#[rustc_dump_vtable]
trait N: J + M {
    //~^ error vtable
    fn foo_n(&self) {}
}

#[rustc_dump_vtable]
trait O: G + N {
    //~^ error vtable
    fn foo_o(&self) {}
}

struct S;

impl A for S {}
impl B for S {}
impl C for S {}
impl D for S {}
impl E for S {}
impl F for S {}
impl G for S {}
impl H for S {}
impl I for S {}
impl J for S {}
impl K for S {}
impl L for S {}
impl M for S {}
impl N for S {}
impl O for S {}

fn foo(_: &dyn O) {}

fn main() {
    foo(&S);
}