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

More TransparentWrapper impls (core::cmp::Reverse and core::num::Saturating) #269

Merged
merged 5 commits into from
Oct 31, 2024

Conversation

zachs18
Copy link
Contributor

@zachs18 zachs18 commented Sep 1, 2024

core::num::Saturating<T> is #[repr(transparent)] and was stabilized in Rust 1.74.0, so a new cargo feature is added transparentwrapper_extra to hold this and other TransparentWrapper impls for types stabilized after Rust 1.34.0.

core::cmp::Reverse<T> was stabilized in Rust 1.19.0, but only gained #[repr(transparent)] in Rust 1.52.0, so it is also under the transparentwrapper_extra feature1.

cc #21

Footnotes

  1. This ensures soundness, since there is no case where feature = "transparentwrapper_extra" compiles on a Rust version where Reverse is not #[repr(transparent)]. Any version of Rust will either: 1. have both stable Saturating and #[repr(transparent)] Reverse (1.74.0 and above), 2. not compile bytemuck with the transparentwrapper_extra feature because Saturating is not stable (below 1.74.0).

@Lokathor Lokathor merged commit af8d110 into Lokathor:main Oct 31, 2024
14 checks passed
@Lokathor Lokathor added semver-patch semver patch change and removed not yet released labels Nov 19, 2024
@Lokathor
Copy link
Owner

released in bytemuck-1.20

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

Successfully merging this pull request may close these issues.

2 participants