Rollup merge of #81879 - imbrem:make-reverse-repr-transparent, r=m-ou-se
Added #[repr(transparent)] to core::cmp::Reverse I found casting from an `&T` to an `&Reverse<T>` potentially useful, but found that `Reverse` was not `#[repr(transparent)]`, so after asking about it [on Reddit](https://www.reddit.com/r/rust/comments/le60uv/make_stdcmpreverse_reprtransparent_and_add_a/), I decided to go ahead and make a pull request which simply adds the attribute to the struct.
This commit is contained in:
commit
0083e6c989
@ -579,6 +579,7 @@ impl Ordering {
|
|||||||
/// ```
|
/// ```
|
||||||
#[derive(PartialEq, Eq, Debug, Copy, Clone, Default, Hash)]
|
#[derive(PartialEq, Eq, Debug, Copy, Clone, Default, Hash)]
|
||||||
#[stable(feature = "reverse_cmp_key", since = "1.19.0")]
|
#[stable(feature = "reverse_cmp_key", since = "1.19.0")]
|
||||||
|
#[repr(transparent)]
|
||||||
pub struct Reverse<T>(#[stable(feature = "reverse_cmp_key", since = "1.19.0")] pub T);
|
pub struct Reverse<T>(#[stable(feature = "reverse_cmp_key", since = "1.19.0")] pub T);
|
||||||
|
|
||||||
#[stable(feature = "reverse_cmp_key", since = "1.19.0")]
|
#[stable(feature = "reverse_cmp_key", since = "1.19.0")]
|
||||||
|
Loading…
Reference in New Issue
Block a user