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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

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).

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

Successfully merging this pull request may close these issues.

1 participant