mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 23:12:02 +00:00
45 lines
518 B
Rust
45 lines
518 B
Rust
//@ build-fail
|
|
#![feature(rustc_attrs)]
|
|
|
|
#[rustc_dump_vtable]
|
|
trait A {
|
|
fn foo_a(&self) {}
|
|
}
|
|
|
|
#[rustc_dump_vtable]
|
|
trait B: A {
|
|
fn foo_b(&self) {}
|
|
}
|
|
|
|
#[rustc_dump_vtable]
|
|
trait C: A {
|
|
//~^ error vtable
|
|
fn foo_c(&self) {}
|
|
}
|
|
|
|
#[rustc_dump_vtable]
|
|
trait D: B + C {
|
|
//~^ error vtable
|
|
fn foo_d(&self) {}
|
|
}
|
|
|
|
struct S;
|
|
|
|
impl A for S {}
|
|
impl B for S {}
|
|
impl C for S {}
|
|
impl D for S {}
|
|
|
|
fn foo(d: &dyn D) {
|
|
d.foo_d();
|
|
}
|
|
|
|
fn bar(d: &dyn C) {
|
|
d.foo_c();
|
|
}
|
|
|
|
fn main() {
|
|
foo(&S);
|
|
bar(&S);
|
|
}
|