use extern type for extra opaqueness

This commit is contained in:
Ralf Jung 2022-07-19 19:57:25 -04:00
parent 5e840c5c8c
commit 114da84996

View File

@ -180,14 +180,15 @@ pub struct DynMetadata<Dyn: ?Sized> {
phantom: crate::marker::PhantomData<Dyn>,
}
/// Opaque type for accessing vtables.
///
/// Private implementation detail of `DynMetadata::size_of` etc.
/// Must be zero-sized since there is conceptually not actually any Abstract Machine memory behind this pointer.
/// However, we can require pointer alignment.
#[repr(C)]
#[cfg(not(bootstrap))]
struct VTable([usize; 0]);
extern "C" {
/// Opaque type for accessing vtables.
///
/// Private implementation detail of `DynMetadata::size_of` etc.
/// Must be zero-sized since there is conceptually not actually any Abstract Machine memory behind this pointer.
/// However, we can require pointer alignment.
type VTable;
}
/// The common prefix of all vtables. It is followed by function pointers for trait methods.
///