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

doctests fail with Rust 1.65+: std::borrow::Cow size assumption no longer valid #52

Open
decathorpe opened this issue Dec 2, 2022 · 3 comments

Comments

@decathorpe
Copy link

As of Rust 1.65.0, many enums are now smaller, probably because of this new optimization:
rust-lang/rust#94075

So as of Rust 1.65.0, std::borrow::Cow is 24 bytes in size, same as beef::Cow (at least on 64-bit architectures, I haven't checked 32-bit architectures).

@Qqwy
Copy link

Qqwy commented Feb 22, 2023

Note: rust-lang/rust#105371

Seems that for rustc 1.65 and 1.66 std::borrow::Cow indeed has become smaller (24 bytes), but in 1.67 it is back to 32 bytes, as result of an optimization for enums which in some cases causes regressions such as this one.

@maciejhirsz
Copy link
Owner

I've been a bit out of the loop for a while, and so I've missed this completely. That optimization being present renders beef pretty much obsolete, though given it's regressed there isn't much for me to do now 🙃.

I'll leave this issue open for posterity, and in case this gets changed back in std can just put a deprecation info on the crate.

@Qqwy
Copy link

Qqwy commented Feb 22, 2023

That optimization being present renders beef pretty much obsolete

I don't think that is entirely true; at the very least the lean version will remain worthwhile even when the regression is fixed.

Also, I think that beef::lean:Cow might work vey nicely together with, for instance, rkyv, since both (by default) optimize space and performance by limiting their content length to 2^32.

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

3 participants