These posts are really interesting and helpful. But when I try to run the following snippet in playground, it seems outdated and reports and error:
thread 'main' panicked at src/main.rs:18:5:
assertion left == right failed
left: 8
right: 0
|
```rust |
|
mod phantom { |
|
pub use self::MyPhantomData::*; |
|
|
|
pub enum MyPhantomData<T: ?Sized> { |
|
MyPhantomData, |
|
|
|
#[allow(dead_code)] |
|
#[doc(hidden)] |
|
Marker(Void, [*const T; 0]), |
|
} |
|
|
|
pub enum Void {} |
|
} |
|
|
|
use phantom::MyPhantomData; |
|
|
|
fn main() { |
|
assert_eq!(std::mem::size_of::<MyPhantomData<usize>>(), 0); |
|
} |
|
``` |
I checked the implementation of https://github.com/dtolnay/ghost but did not find the difference.
These posts are really interesting and helpful. But when I try to run the following snippet in playground, it seems outdated and reports and error:
case-studies/unit-type-parameters/README.md
Lines 328 to 348 in 4c3517a
I checked the implementation of https://github.com/dtolnay/ghost but did not find the difference.