@@ -784,6 +784,16 @@ mod method_supertraits {
784
784
785
785
impl < T > MyTrait3 < T > for MyThing2 < T > { }
786
786
787
+ fn call_trait_m1 < T1 , T2 : MyTrait1 < T1 > > ( x : T2 ) -> T1 {
788
+ x. m1 ( ) // $ method=MyTrait1::m1
789
+ }
790
+
791
+ fn type_param_trait_to_supertrait < T : MyTrait3 < S1 > > ( x : T ) {
792
+ // Test that `MyTrait3` is a subtrait of `MyTrait1<MyThing<S1>>`
793
+ let a = x. m1 ( ) ; // $ method=MyTrait1::m1 type=a:MyThing type=a:A.S1
794
+ println ! ( "{:?}" , a) ;
795
+ }
796
+
787
797
pub fn f ( ) {
788
798
let x = MyThing { a : S1 } ;
789
799
let y = MyThing { a : S2 } ;
@@ -802,6 +812,12 @@ mod method_supertraits {
802
812
803
813
println ! ( "{:?}" , x. m3( ) ) ; // $ method=m3 type=x.m3():S1
804
814
println ! ( "{:?}" , y. m3( ) ) ; // $ method=m3 type=y.m3():S2
815
+
816
+ let x = MyThing { a : S1 } ;
817
+ let s = call_trait_m1 ( x) ; // $ type=s:S1
818
+
819
+ let x = MyThing2 { a : S2 } ;
820
+ let s = call_trait_m1 ( x) ; // $ type=s:MyThing type=s:A.S2
805
821
}
806
822
}
807
823
@@ -1054,6 +1070,12 @@ mod method_call_type_conversion {
1054
1070
let x6 = & S ( S2 ) ;
1055
1071
// explicit dereference
1056
1072
println ! ( "{:?}" , ( * x6) . m1( ) ) ; // $ method=m1
1073
+
1074
+ let x7 = S ( & S2 ) ;
1075
+ // Non-implicit dereference with nested borrow in order to test that the
1076
+ // implicit dereference handling doesn't affect nested borrows.
1077
+ let t = x7. m1 ( ) ; // $ method=m1 type=t:& type=t:&T.S2
1078
+ println ! ( "{:?}" , x7) ;
1057
1079
}
1058
1080
}
1059
1081
0 commit comments