blob: 92bd4a230d83831f6e17ed5e9a2eac01b10f6fa5 [file] [log] [blame]
Protobuf Team Bot5c7a9fd2024-04-16 07:03:22 -07001// Macro to create structs that will act as opaque pointees. These structs are
2// never intended to be dereferenced in Rust.
3// This is a workaround until stabilization of [`extern type`].
4// TODO: convert to extern type once stabilized.
5// [`extern type`]: https://github.com/rust-lang/rust/issues/43467
6macro_rules! opaque_pointee {
7 ($name: ident) => {
8 #[repr(C)]
9 pub struct $name {
10 _data: [u8; 0],
11 _marker: std::marker::PhantomData<(*mut u8, std::marker::PhantomPinned)>,
12 }
13 };
14}
15
16pub(crate) use opaque_pointee;