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

tendril::test::assert_sizes fails with Rust 1.64.0+ #66

Open
decathorpe opened this issue Oct 1, 2022 · 0 comments
Open

tendril::test::assert_sizes fails with Rust 1.64.0+ #66

decathorpe opened this issue Oct 1, 2022 · 0 comments

Comments

@decathorpe
Copy link
Sponsor

Looks like the expected size of ByteTendril has changed with Rust 1.64.0:

---- tendril::test::assert_sizes stdout ----
thread 'tendril::test::assert_sizes' panicked at 'assertion failed: `(left == right)`
  left: `16`,
 right: `24`', src/tendril.rs:1704:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Line src/tendril.rs:1704 points at this assert:

assert_eq!(correct, mem::size_of::<Option<ByteTendril>>());

The same test passes with Rust 1.63 and earlier.

I can't really see how ByteTendril still has the expected size, but Option<ByteTendril> is now 50% bigger. Unless ... Rust 1.64.0 no longer does "niche" optimization for the Option in this case? I can see how it might be "tempting" to assign a niche for None to the case where the ptr: Cell<NonZeroUsize> is actually zero - but can this ever be correct for a repr(C) struct? I don't see anything that might be related to this problem in the Rust 1.64.0 release notes.

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

1 participant