diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index e085d427b8c..680a0f5b2c0 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -836,7 +836,7 @@ pub unsafe fn transmute_copy(src: &T) -> U { /// /// See the `discriminant` function in this module for more information. #[stable(feature = "discriminant_value", since = "1.21.0")] -pub struct Discriminant(u64, PhantomData<*const T>); +pub struct Discriminant(u64, PhantomData T>); // N.B. These trait implementations cannot be derived because we don't want any bounds on T. diff --git a/src/libcore/tests/mem.rs b/src/libcore/tests/mem.rs index 86e59c736ba..f55a1c81463 100644 --- a/src/libcore/tests/mem.rs +++ b/src/libcore/tests/mem.rs @@ -121,3 +121,19 @@ fn test_transmute() { } } +#[test] +#[allow(dead_code)] +fn test_discriminant_send_sync() { + enum Regular { + A, + B(i32) + } + enum NotSendSync { + A(*const i32) + } + + fn is_send_sync() { } + + is_send_sync::>(); + is_send_sync::>(); +}