More TransparentWrapper
impls (core::cmp::Reverse
and core::num::Saturating
)
#269
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
core::num::Saturating<T>
is#[repr(transparent)]
and was stabilized in Rust 1.74.0, so a new cargo feature is addedtransparentwrapper_extra
to hold this and otherTransparentWrapper
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 thetransparentwrapper_extra
feature1.cc #21
Footnotes
This ensures soundness, since there is no case where
feature = "transparentwrapper_extra"
compiles on a Rust version whereReverse
is not#[repr(transparent)]
. Any version of Rust will either: 1. have both stableSaturating
and#[repr(transparent)] Reverse
(1.74.0 and above), 2. not compilebytemuck
with thetransparentwrapper_extra
feature becauseSaturating
is not stable (below 1.74.0). ↩