Expand description
Dumps the virtual method table (“vtable”) of the annotated item.
See also the vtable_entries query.
See AttributeKind::RustcDumpVtable for the internal representation of this attribute.
§Example
ⓘ
//@ dont-require-annotations: ERROR
//@ compile-flags: --crate-type lib -Z ui-testing=no
#![feature(rustc_attrs)]
#[rustc_dump_vtable]
type X = dyn Send;
#[rustc_dump_vtable]
type Y = dyn core::any::Any;
struct C;
#[rustc_dump_vtable]
impl Iterator for C {
type Item = ();
fn next(&mut self) -> Option<Self::Item> {
Some(())
}
}produces:
error: vtable entries: [
MetadataDropInPlace,
MetadataSize,
MetadataAlign,
]
--> $DIR/rustc_dump_vtable.rs:7:1
|
7 | type X = dyn Send;
| ^^^^^^
error: vtable entries: [
MetadataDropInPlace,
MetadataSize,
MetadataAlign,
Method(<dyn Any as Any>::type_id - shim(reify)),
]
--> $DIR/rustc_dump_vtable.rs:10:1
|
10 | type Y = dyn core::any::Any;
| ^^^^^^
error: vtable entries: [
MetadataDropInPlace,
MetadataSize,
MetadataAlign,
Method(<C as Iterator>::next),
Method(<C as Iterator>::size_hint),
Method(<C as Iterator>::advance_by),
Method(<C as Iterator>::nth),
]
--> $DIR/rustc_dump_vtable.rs:15:1
|
15 | impl Iterator for C {
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors