diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index af2f876a2f3..bae1f4dee14 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -712,39 +712,39 @@ pub unsafe fn transmute_copy(src: &T) -> U { /// Opaque type representing the discriminant of an enum. /// /// See the `discriminant` function in this module for more information. -#[stable(feature = "discriminant_value", since = "1.22.0")] +#[stable(feature = "discriminant_value", since = "1.21.0")] pub struct Discriminant(u64, PhantomData<*const T>); // N.B. These trait implementations cannot be derived because we don't want any bounds on T. -#[stable(feature = "discriminant_value", since = "1.22.0")] +#[stable(feature = "discriminant_value", since = "1.21.0")] impl Copy for Discriminant {} -#[stable(feature = "discriminant_value", since = "1.22.0")] +#[stable(feature = "discriminant_value", since = "1.21.0")] impl clone::Clone for Discriminant { fn clone(&self) -> Self { *self } } -#[stable(feature = "discriminant_value", since = "1.22.0")] +#[stable(feature = "discriminant_value", since = "1.21.0")] impl cmp::PartialEq for Discriminant { fn eq(&self, rhs: &Self) -> bool { self.0 == rhs.0 } } -#[stable(feature = "discriminant_value", since = "1.22.0")] +#[stable(feature = "discriminant_value", since = "1.21.0")] impl cmp::Eq for Discriminant {} -#[stable(feature = "discriminant_value", since = "1.22.0")] +#[stable(feature = "discriminant_value", since = "1.21.0")] impl hash::Hash for Discriminant { fn hash(&self, state: &mut H) { self.0.hash(state); } } -#[stable(feature = "discriminant_value", since = "1.22.0")] +#[stable(feature = "discriminant_value", since = "1.21.0")] impl fmt::Debug for Discriminant { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_tuple("Discriminant") @@ -777,7 +777,7 @@ impl fmt::Debug for Discriminant { /// assert!(mem::discriminant(&Foo::B(1)) == mem::discriminant(&Foo::B(2))); /// assert!(mem::discriminant(&Foo::B(3)) != mem::discriminant(&Foo::C(3))); /// ``` -#[stable(feature = "discriminant_value", since = "1.22.0")] +#[stable(feature = "discriminant_value", since = "1.21.0")] pub fn discriminant(v: &T) -> Discriminant { unsafe { Discriminant(intrinsics::discriminant_value(v), PhantomData)