We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
mem::Discriminant
1 parent 7184d13 commit 57c4db3Copy full SHA for 57c4db3
src/libcore/mem/mod.rs
@@ -929,8 +929,9 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
929
/// See the [`discriminant`] function in this module for more information.
930
///
931
/// [`discriminant`]: fn.discriminant.html
932
+// We use `PhantomData<fn(T) -> T>` because we want `Discriminant` to be invariant.
933
#[stable(feature = "discriminant_value", since = "1.21.0")]
-pub struct Discriminant<T>(u64, PhantomData<fn() -> T>);
934
+pub struct Discriminant<T>(u64, PhantomData<fn(T) -> T>);
935
936
// N.B. These trait implementations cannot be derived because we don't want any bounds on T.
937
0 commit comments