about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-07-19 19:57:25 -0400
committerRalf Jung <post@ralfj.de>2022-07-20 17:12:07 -0400
commit114da8499642b0b29d624c7e30c8f07e25933ff6 (patch)
treeb26f886225a7ab52bdb81d81f4b2609036b78391
parent5e840c5c8c75081dda4b33f8afcb0c77ad3105bb (diff)
use extern type for extra opaqueness
-rw-r--r--library/core/src/ptr/metadata.rs15
1 files 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<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.
 ///