@@ -483,64 +483,6 @@ impl<T: ?Sized> !Sync for *const T {}
483483#[ stable( feature = "rust1" , since = "1.0.0" ) ]
484484impl < T : ?Sized > !Sync for * mut T { }
485485
486- macro_rules! impls {
487- ( $t: ident) => {
488- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
489- impl <T : ?Sized > Hash for $t<T > {
490- #[ inline]
491- fn hash<H : Hasher >( & self , _: & mut H ) { }
492- }
493-
494- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
495- impl <T : ?Sized > cmp:: PartialEq for $t<T > {
496- fn eq( & self , _other: & $t<T >) -> bool {
497- true
498- }
499- }
500-
501- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
502- impl <T : ?Sized > cmp:: Eq for $t<T > { }
503-
504- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
505- impl <T : ?Sized > cmp:: PartialOrd for $t<T > {
506- fn partial_cmp( & self , _other: & $t<T >) -> Option <cmp:: Ordering > {
507- Option :: Some ( cmp:: Ordering :: Equal )
508- }
509- }
510-
511- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
512- impl <T : ?Sized > cmp:: Ord for $t<T > {
513- fn cmp( & self , _other: & $t<T >) -> cmp:: Ordering {
514- cmp:: Ordering :: Equal
515- }
516- }
517-
518- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
519- impl <T : ?Sized > Copy for $t<T > { }
520-
521- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
522- impl <T : ?Sized > Clone for $t<T > {
523- fn clone( & self ) -> Self {
524- Self
525- }
526- }
527-
528- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
529- #[ rustc_const_unstable( feature = "const_default_impls" , issue = "87864" ) ]
530- impl <T : ?Sized > const Default for $t<T > {
531- fn default ( ) -> Self {
532- Self
533- }
534- }
535-
536- #[ unstable( feature = "structural_match" , issue = "31434" ) ]
537- impl <T : ?Sized > StructuralPartialEq for $t<T > { }
538-
539- #[ unstable( feature = "structural_match" , issue = "31434" ) ]
540- impl <T : ?Sized > StructuralEq for $t<T > { }
541- } ;
542- }
543-
544486/// Zero-sized type used to mark things that "act like" they own a `T`.
545487///
546488/// Adding a `PhantomData<T>` field to your type tells the compiler that your
@@ -678,7 +620,59 @@ macro_rules! impls {
678620#[ stable( feature = "rust1" , since = "1.0.0" ) ]
679621pub struct PhantomData < T : ?Sized > ;
680622
681- impls ! { PhantomData }
623+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
624+ impl < T : ?Sized > Hash for PhantomData < T > {
625+ #[ inline]
626+ fn hash < H : Hasher > ( & self , _: & mut H ) { }
627+ }
628+
629+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
630+ impl < T : ?Sized > cmp:: PartialEq for PhantomData < T > {
631+ fn eq ( & self , _other : & PhantomData < T > ) -> bool {
632+ true
633+ }
634+ }
635+
636+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
637+ impl < T : ?Sized > cmp:: Eq for PhantomData < T > { }
638+
639+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
640+ impl < T : ?Sized > cmp:: PartialOrd for PhantomData < T > {
641+ fn partial_cmp ( & self , _other : & PhantomData < T > ) -> Option < cmp:: Ordering > {
642+ Option :: Some ( cmp:: Ordering :: Equal )
643+ }
644+ }
645+
646+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
647+ impl < T : ?Sized > cmp:: Ord for PhantomData < T > {
648+ fn cmp ( & self , _other : & PhantomData < T > ) -> cmp:: Ordering {
649+ cmp:: Ordering :: Equal
650+ }
651+ }
652+
653+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
654+ impl < T : ?Sized > Copy for PhantomData < T > { }
655+
656+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
657+ impl < T : ?Sized > Clone for PhantomData < T > {
658+ fn clone ( & self ) -> Self {
659+ Self
660+ }
661+ }
662+
663+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
664+ #[ rustc_const_unstable( feature = "const_default_impls" , issue = "87864" ) ]
665+ impl < T : ?Sized > const Default for PhantomData < T > {
666+ fn default ( ) -> Self {
667+ Self
668+ }
669+ }
670+
671+ #[ unstable( feature = "structural_match" , issue = "31434" ) ]
672+ impl < T : ?Sized > StructuralPartialEq for PhantomData < T > { }
673+
674+ #[ unstable( feature = "structural_match" , issue = "31434" ) ]
675+ impl < T : ?Sized > StructuralEq for PhantomData < T > { }
682676
683677mod impls {
684678 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
0 commit comments