Skip to content

Outdated information in "unit-type-parameters" chapter? #20

@Forsworns

Description

@Forsworns

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions