From 114da8499642b0b29d624c7e30c8f07e25933ff6 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 19 Jul 2022 19:57:25 -0400 Subject: [PATCH] use extern type for extra opaqueness --- library/core/src/ptr/metadata.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/library/core/src/ptr/metadata.rs b/library/core/src/ptr/metadata.rs index 25cc852200a..2becaa83362 100644 --- a/library/core/src/ptr/metadata.rs +++ b/library/core/src/ptr/metadata.rs @@ -180,14 +180,15 @@ pub struct DynMetadata { phantom: crate::marker::PhantomData, } -/// 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. ///