about summary refs log tree commit diff
path: root/tests/ui/traits/vtable/multiple-auto.rs
blob: 87ee865868bb70188898643833327f8e9f775e0f (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
// Related to <https://github.com/rust-lang/rust/issues/113840>
//
// This test makes sure that multiple auto traits can reuse the
// same pointer for upcasting (e.g. `Send`/`Sync`)

#![crate_type = "lib"]
#![feature(rustc_attrs, auto_traits)]

// Markers
auto trait M0 {}
auto trait M1 {}
auto trait M2 {}

// Just a trait with a method
trait T {
    fn method(&self) {}
}

trait A: M0 + M1 + M2 + T {}

trait B: M0 + M1 + T + M2 {}

trait C: M0 + T + M1 + M2 {}

trait D: T + M0 + M1 + M2 {}

struct S;

impl M0 for S {}
impl M1 for S {}
impl M2 for S {}
impl T for S {}

#[rustc_dump_vtable]
impl A for S {}
//~^ ERROR vtable entries

#[rustc_dump_vtable]
impl B for S {}
//~^ ERROR vtable entries

#[rustc_dump_vtable]
impl C for S {}
//~^ ERROR vtable entries

#[rustc_dump_vtable]
impl D for S {}
//~^ ERROR vtable entries

fn main() {}