Skip to content

Commit e9b1721

Browse files
committed
use extern type for extra opaqueness
1 parent a27bdbc commit e9b1721

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

library/core/src/ptr/metadata.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,15 @@ pub struct DynMetadata<Dyn: ?Sized> {
180180
phantom: crate::marker::PhantomData<Dyn>,
181181
}
182182

183-
/// Opaque type for accessing vtables.
184-
///
185-
/// Private implementation detail of `DynMetadata::size_of` etc.
186-
/// Must be zero-sized since there is conceptually not actually any Abstract Machine memory behind this pointer.
187-
/// However, we can require pointer alignment.
188-
#[repr(C)]
189183
#[cfg(not(bootstrap))]
190-
struct VTable([usize; 0]);
184+
extern "C" {
185+
/// Opaque type for accessing vtables.
186+
///
187+
/// Private implementation detail of `DynMetadata::size_of` etc.
188+
/// Must be zero-sized since there is conceptually not actually any Abstract Machine memory behind this pointer.
189+
/// However, we can require pointer alignment.
190+
type VTable;
191+
}
191192

192193
/// The common prefix of all vtables. It is followed by function pointers for trait methods.
193194
///

0 commit comments

Comments
 (0)