Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Forsworns opened this issue Jan 27, 2025 · 1 comment
Open

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

Forsworns opened this issue Jan 27, 2025 · 1 comment

Comments

@Forsworns
Copy link

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.

@dtolnay
Copy link
Owner

dtolnay commented Jan 27, 2025

Yeah the layout algorithm changed in Rust 1.74 due to rust-lang/rust#115277. Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants