@@ -29,7 +29,7 @@ macro_rules! tuple_impls {
2929 }
3030
3131 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
32- impl <$( $T: PartialEq ) ,+> PartialEq for ( $( $T, ) +) {
32+ impl <$( $T: PartialEq ) ,+> PartialEq for ( $( $T, ) +) where last_type! ( $ ( $T , ) + ) : ? Sized {
3333 #[ inline]
3434 fn eq( & self , other: & ( $( $T, ) +) ) -> bool {
3535 $( self . $idx == other. $idx) &&+
@@ -41,10 +41,11 @@ macro_rules! tuple_impls {
4141 }
4242
4343 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
44- impl <$( $T: Eq ) ,+> Eq for ( $( $T, ) +) { }
44+ impl <$( $T: Eq ) ,+> Eq for ( $( $T, ) +) where last_type! ( $ ( $T , ) + ) : ? Sized { }
4545
4646 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
47- impl <$( $T: PartialOrd + PartialEq ) ,+> PartialOrd for ( $( $T, ) +) {
47+ impl <$( $T: PartialOrd + PartialEq ) ,+> PartialOrd for ( $( $T, ) +)
48+ where last_type!( $( $T, ) +) : ?Sized {
4849 #[ inline]
4950 fn partial_cmp( & self , other: & ( $( $T, ) +) ) -> Option <Ordering > {
5051 lexical_partial_cmp!( $( self . $idx, other. $idx) ,+)
@@ -68,7 +69,7 @@ macro_rules! tuple_impls {
6869 }
6970
7071 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
71- impl <$( $T: Ord ) ,+> Ord for ( $( $T, ) +) {
72+ impl <$( $T: Ord ) ,+> Ord for ( $( $T, ) +) where last_type! ( $ ( $T , ) + ) : ? Sized {
7273 #[ inline]
7374 fn cmp( & self , other: & ( $( $T, ) +) ) -> Ordering {
7475 lexical_cmp!( $( self . $idx, other. $idx) ,+)
@@ -118,6 +119,11 @@ macro_rules! lexical_cmp {
118119 ( $a: expr, $b: expr) => { ( $a) . cmp( & $b) } ;
119120}
120121
122+ macro_rules! last_type {
123+ ( $a: ident, ) => { $a } ;
124+ ( $a: ident, $( $rest_a: ident, ) +) => { last_type!( $( $rest_a, ) +) } ;
125+ }
126+
121127tuple_impls ! {
122128 Tuple1 {
123129 ( 0 ) -> A
0 commit comments