2021-07-17 15:44:19 +08:00
|
|
|
// build-fail
|
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
|
|
|
|
#[rustc_dump_vtable]
|
|
|
|
trait A {
|
|
|
|
fn foo_a(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[rustc_dump_vtable]
|
|
|
|
trait B {
|
2021-10-03 15:53:02 +09:00
|
|
|
//~^ error vtable
|
2021-07-17 15:44:19 +08:00
|
|
|
fn foo_b(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[rustc_dump_vtable]
|
|
|
|
trait C: A + B {
|
2021-10-03 15:53:02 +09:00
|
|
|
//~^ error vtable
|
2021-07-17 15:44:19 +08:00
|
|
|
fn foo_c(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct S;
|
|
|
|
|
|
|
|
impl A for S {}
|
|
|
|
impl B for S {}
|
|
|
|
impl C for S {}
|
|
|
|
|
|
|
|
fn foo(c: &dyn C) {}
|
2022-07-17 16:17:25 -04:00
|
|
|
fn bar(c: &dyn B) {}
|
2021-07-17 15:44:19 +08:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
foo(&S);
|
2022-07-17 16:17:25 -04:00
|
|
|
bar(&S);
|
2021-07-17 15:44:19 +08:00
|
|
|
}
|