Protobuf Team Bot | 5c7a9fd | 2024-04-16 07:03:22 -0700 | [diff] [blame] | 1 | // 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 |
| 6 | macro_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 | |
| 16 | pub(crate) use opaque_pointee; |