@@ -453,158 +453,7 @@ mod method_non_parametric_trait_impl {
453453 }
454454}
455455
456- mod impl_overlap {
457- #[ derive( Debug , Clone , Copy ) ]
458- struct S1 ;
459-
460- trait OverlappingTrait {
461- fn common_method ( self ) -> S1 ;
462-
463- fn common_method_2 ( self , s1 : S1 ) -> S1 ;
464- }
465-
466- impl OverlappingTrait for S1 {
467- // <S1_as_OverlappingTrait>::common_method
468- fn common_method ( self ) -> S1 {
469- S1
470- }
471-
472- // <S1_as_OverlappingTrait>::common_method_2
473- fn common_method_2 ( self , s1 : S1 ) -> S1 {
474- S1
475- }
476- }
477-
478- impl S1 {
479- // S1::common_method
480- fn common_method ( self ) -> S1 {
481- self
482- }
483-
484- // S1::common_method_2
485- fn common_method_2 ( self ) -> S1 {
486- self
487- }
488- }
489-
490- struct S2 < T2 > ( T2 ) ;
491-
492- impl S2 < i32 > {
493- // S2<i32>::common_method
494- fn common_method ( self ) -> S1 {
495- S1
496- }
497-
498- // S2<i32>::common_method
499- fn common_method_2 ( self ) -> S1 {
500- S1
501- }
502- }
503-
504- impl OverlappingTrait for S2 < i32 > {
505- // <S2<i32>_as_OverlappingTrait>::common_method
506- fn common_method ( self ) -> S1 {
507- S1
508- }
509-
510- // <S2<i32>_as_OverlappingTrait>::common_method_2
511- fn common_method_2 ( self , s1 : S1 ) -> S1 {
512- S1
513- }
514- }
515-
516- impl OverlappingTrait for S2 < S1 > {
517- // <S2<S1>_as_OverlappingTrait>::common_method
518- fn common_method ( self ) -> S1 {
519- S1
520- }
521-
522- // <S2<S1>_as_OverlappingTrait>::common_method_2
523- fn common_method_2 ( self , s1 : S1 ) -> S1 {
524- S1
525- }
526- }
527-
528- #[ derive( Debug ) ]
529- struct S3 < T3 > ( T3 ) ;
530-
531- trait OverlappingTrait2 < T > {
532- fn m ( & self , x : & T ) -> & Self ;
533- }
534-
535- impl < T > OverlappingTrait2 < T > for S3 < T > {
536- // <S3<T>_as_OverlappingTrait2<T>>::m
537- fn m ( & self , x : & T ) -> & Self {
538- self
539- }
540- }
541-
542- impl < T > S3 < T > {
543- // S3<T>::m
544- fn m ( & self , x : T ) -> & Self {
545- self
546- }
547- }
548-
549- trait MyTrait1 {
550- // MyTrait1::m
551- fn m ( & self ) { }
552- }
553-
554- trait MyTrait2 : MyTrait1 { }
555-
556- #[ derive( Debug ) ]
557- struct S4 ;
558-
559- impl MyTrait1 for S4 {
560- // <S4_as_MyTrait1>::m
561- fn m ( & self ) { }
562- }
563-
564- impl MyTrait2 for S4 { }
565-
566- #[ derive( Debug ) ]
567- struct S5 < T5 > ( T5 ) ;
568-
569- impl MyTrait1 for S5 < i32 > {
570- // <S5<i32>_as_MyTrait1>::m
571- fn m ( & self ) { }
572- }
573-
574- impl MyTrait2 for S5 < i32 > { }
575-
576- impl MyTrait1 for S5 < bool > { }
577-
578- impl MyTrait2 for S5 < bool > { }
579-
580- pub fn f ( ) {
581- let x = S1 ;
582- println ! ( "{:?}" , x. common_method( ) ) ; // $ target=S1::common_method
583- println ! ( "{:?}" , S1 :: common_method( x) ) ; // $ target=S1::common_method
584- println ! ( "{:?}" , x. common_method_2( ) ) ; // $ target=S1::common_method_2
585- println ! ( "{:?}" , S1 :: common_method_2( x) ) ; // $ target=S1::common_method_2
586-
587- let y = S2 ( S1 ) ;
588- println ! ( "{:?}" , y. common_method( ) ) ; // $ target=<S2<S1>_as_OverlappingTrait>::common_method
589- println ! ( "{:?}" , S2 :: <S1 >:: common_method( S2 ( S1 ) ) ) ; // $ target=<S2<S1>_as_OverlappingTrait>::common_method
590-
591- let z = S2 ( 0 ) ;
592- println ! ( "{:?}" , z. common_method( ) ) ; // $ target=S2<i32>::common_method
593- println ! ( "{:?}" , S2 :: common_method( S2 ( 0 ) ) ) ; // $ target=S2<i32>::common_method
594- println ! ( "{:?}" , S2 :: <i32 >:: common_method( S2 ( 0 ) ) ) ; // $ target=S2<i32>::common_method
595-
596- let w = S3 ( S1 ) ;
597- println ! ( "{:?}" , w. m( x) ) ; // $ target=S3<T>::m
598- println ! ( "{:?}" , S3 :: m( & w, x) ) ; // $ target=S3<T>::m
599-
600- S4 . m ( ) ; // $ target=<S4_as_MyTrait1>::m
601- S4 :: m ( & S4 ) ; // $ target=<S4_as_MyTrait1>::m
602- S5 ( 0i32 ) . m ( ) ; // $ target=<S5<i32>_as_MyTrait1>::m
603- S5 :: m ( & S5 ( 0i32 ) ) ; // $ target=<S5<i32>_as_MyTrait1>::m
604- S5 ( true ) . m ( ) ; // $ target=MyTrait1::m
605- S5 :: m ( & S5 ( true ) ) ; // $ target=MyTrait1::m
606- }
607- }
456+ mod overloading;
608457
609458mod type_parameter_bounds {
610459 use std:: fmt:: Debug ;
0 commit comments