@@ -634,7 +634,18 @@ impl<T: Default> Default for Rc<T> {
634634}
635635
636636#[ stable( feature = "rust1" , since = "1.0.0" ) ]
637+ #[ cfg( stage0) ]
637638impl < T : PartialEq > PartialEq for Rc < T > {
639+ #[ inline( always) ]
640+ fn eq ( & self , other : & Rc < T > ) -> bool { * * self == * * other }
641+
642+ #[ inline( always) ]
643+ fn ne ( & self , other : & Rc < T > ) -> bool { * * self != * * other }
644+ }
645+
646+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
647+ #[ cfg( not( stage0) ) ]
648+ impl < T : ?Sized + PartialEq > PartialEq for Rc < T > {
638649 /// Equality for two `Rc<T>`s.
639650 ///
640651 /// Two `Rc<T>`s are equal if their inner value are equal.
@@ -669,10 +680,35 @@ impl<T: PartialEq> PartialEq for Rc<T> {
669680}
670681
671682#[ stable( feature = "rust1" , since = "1.0.0" ) ]
683+ #[ cfg( stage0) ]
672684impl < T : Eq > Eq for Rc < T > { }
685+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
686+ #[ cfg( not( stage0) ) ]
687+ impl < T : ?Sized + Eq > Eq for Rc < T > { }
673688
674689#[ stable( feature = "rust1" , since = "1.0.0" ) ]
690+ #[ cfg( stage0) ]
675691impl < T : PartialOrd > PartialOrd for Rc < T > {
692+ #[ inline( always) ]
693+ fn partial_cmp ( & self , other : & Rc < T > ) -> Option < Ordering > {
694+ ( * * self ) . partial_cmp ( & * * other)
695+ }
696+
697+ #[ inline( always) ]
698+ fn lt ( & self , other : & Rc < T > ) -> bool { * * self < * * other }
699+
700+ #[ inline( always) ]
701+ fn le ( & self , other : & Rc < T > ) -> bool { * * self <= * * other }
702+
703+ #[ inline( always) ]
704+ fn gt ( & self , other : & Rc < T > ) -> bool { * * self > * * other }
705+
706+ #[ inline( always) ]
707+ fn ge ( & self , other : & Rc < T > ) -> bool { * * self >= * * other }
708+ }
709+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
710+ #[ cfg( not( stage0) ) ]
711+ impl < T : ?Sized + PartialOrd > PartialOrd for Rc < T > {
676712 /// Partial comparison for two `Rc<T>`s.
677713 ///
678714 /// The two are compared by calling `partial_cmp()` on their inner values.
@@ -757,7 +793,14 @@ impl<T: PartialOrd> PartialOrd for Rc<T> {
757793}
758794
759795#[ stable( feature = "rust1" , since = "1.0.0" ) ]
796+ #[ cfg( stage0) ]
760797impl < T : Ord > Ord for Rc < T > {
798+ #[ inline]
799+ fn cmp ( & self , other : & Rc < T > ) -> Ordering { ( * * self ) . cmp ( & * * other) }
800+ }
801+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
802+ #[ cfg( not( stage0) ) ]
803+ impl < T : ?Sized + Ord > Ord for Rc < T > {
761804 /// Comparison for two `Rc<T>`s.
762805 ///
763806 /// The two are compared by calling `cmp()` on their inner values.
@@ -1399,4 +1442,9 @@ mod tests {
13991442 assert_eq ! ( format!( "{:?}" , foo) , "75" ) ;
14001443 }
14011444
1445+ #[ test]
1446+ fn test_unsized ( ) {
1447+ let foo: Rc < [ i32 ] > = Rc :: new ( [ 1 , 2 , 3 ] ) ;
1448+ assert_eq ! ( foo, foo. clone( ) ) ;
1449+ }
14021450}
0 commit comments