diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index d5ed52124e2ca..c43c4fff6ae77 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -483,64 +483,6 @@ impl !Sync for *const T {} #[stable(feature = "rust1", since = "1.0.0")] impl !Sync for *mut T {} -macro_rules! impls { - ($t: ident) => { - #[stable(feature = "rust1", since = "1.0.0")] - impl Hash for $t { - #[inline] - fn hash(&self, _: &mut H) {} - } - - #[stable(feature = "rust1", since = "1.0.0")] - impl cmp::PartialEq for $t { - fn eq(&self, _other: &$t) -> bool { - true - } - } - - #[stable(feature = "rust1", since = "1.0.0")] - impl cmp::Eq for $t {} - - #[stable(feature = "rust1", since = "1.0.0")] - impl cmp::PartialOrd for $t { - fn partial_cmp(&self, _other: &$t) -> Option { - Option::Some(cmp::Ordering::Equal) - } - } - - #[stable(feature = "rust1", since = "1.0.0")] - impl cmp::Ord for $t { - fn cmp(&self, _other: &$t) -> cmp::Ordering { - cmp::Ordering::Equal - } - } - - #[stable(feature = "rust1", since = "1.0.0")] - impl Copy for $t {} - - #[stable(feature = "rust1", since = "1.0.0")] - impl Clone for $t { - fn clone(&self) -> Self { - Self - } - } - - #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_default_impls", issue = "87864")] - impl const Default for $t { - fn default() -> Self { - Self - } - } - - #[unstable(feature = "structural_match", issue = "31434")] - impl StructuralPartialEq for $t {} - - #[unstable(feature = "structural_match", issue = "31434")] - impl StructuralEq for $t {} - }; -} - /// Zero-sized type used to mark things that "act like" they own a `T`. /// /// Adding a `PhantomData` field to your type tells the compiler that your @@ -678,7 +620,59 @@ macro_rules! impls { #[stable(feature = "rust1", since = "1.0.0")] pub struct PhantomData; -impls! { PhantomData } +#[stable(feature = "rust1", since = "1.0.0")] +impl Hash for PhantomData { + #[inline] + fn hash(&self, _: &mut H) {} +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl cmp::PartialEq for PhantomData { + fn eq(&self, _other: &PhantomData) -> bool { + true + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl cmp::Eq for PhantomData {} + +#[stable(feature = "rust1", since = "1.0.0")] +impl cmp::PartialOrd for PhantomData { + fn partial_cmp(&self, _other: &PhantomData) -> Option { + Option::Some(cmp::Ordering::Equal) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl cmp::Ord for PhantomData { + fn cmp(&self, _other: &PhantomData) -> cmp::Ordering { + cmp::Ordering::Equal + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Copy for PhantomData {} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Clone for PhantomData { + fn clone(&self) -> Self { + Self + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")] +impl const Default for PhantomData { + fn default() -> Self { + Self + } +} + +#[unstable(feature = "structural_match", issue = "31434")] +impl StructuralPartialEq for PhantomData {} + +#[unstable(feature = "structural_match", issue = "31434")] +impl StructuralEq for PhantomData {} mod impls { #[stable(feature = "rust1", since = "1.0.0")]