Skip to content

Commit 0083e6c

Browse files
authored
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.
2 parents c013dc0 + f847ff1 commit 0083e6c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

library/core/src/cmp.rs

+1
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ impl Ordering {
579579
/// ```
580580
#[derive(PartialEq, Eq, Debug, Copy, Clone, Default, Hash)]
581581
#[stable(feature = "reverse_cmp_key", since = "1.19.0")]
582+
#[repr(transparent)]
582583
pub struct Reverse<T>(#[stable(feature = "reverse_cmp_key", since = "1.19.0")] pub T);
583584

584585
#[stable(feature = "reverse_cmp_key", since = "1.19.0")]

0 commit comments

Comments
 (0)