@@ -1873,8 +1873,10 @@ mod async_ {
1873
1873
}
1874
1874
1875
1875
mod impl_trait {
1876
+ #[ derive( Copy , Clone ) ]
1876
1877
struct S1 ;
1877
1878
struct S2 ;
1879
+ struct S3 < T3 > ( T3 ) ;
1878
1880
1879
1881
trait Trait1 {
1880
1882
fn f1 ( & self ) { } // Trait1f1
@@ -1906,6 +1908,13 @@ mod impl_trait {
1906
1908
}
1907
1909
}
1908
1910
1911
+ impl < T : Clone > MyTrait < T > for S3 < T > {
1912
+ fn get_a ( & self ) -> T {
1913
+ let S3 ( t) = self ;
1914
+ t. clone ( )
1915
+ }
1916
+ }
1917
+
1909
1918
fn get_a_my_trait ( ) -> impl MyTrait < S2 > {
1910
1919
S1
1911
1920
}
@@ -1914,6 +1923,14 @@ mod impl_trait {
1914
1923
t. get_a ( ) // $ target=MyTrait::get_a
1915
1924
}
1916
1925
1926
+ fn get_a_my_trait2 < T : Clone > ( x : T ) -> impl MyTrait < T > {
1927
+ S3 ( x)
1928
+ }
1929
+
1930
+ fn get_a_my_trait3 < T : Clone > ( x : T ) -> Option < impl MyTrait < T > > {
1931
+ Some ( S3 ( x) )
1932
+ }
1933
+
1917
1934
fn uses_my_trait2 < A > ( t : impl MyTrait < A > ) -> A {
1918
1935
t. get_a ( ) // $ target=MyTrait::get_a
1919
1936
}
@@ -1927,6 +1944,9 @@ mod impl_trait {
1927
1944
let a = get_a_my_trait ( ) ; // $ target=get_a_my_trait
1928
1945
let c = uses_my_trait2 ( a) ; // $ type=c:S2 target=uses_my_trait2
1929
1946
let d = uses_my_trait2 ( S1 ) ; // $ type=d:S2 target=uses_my_trait2
1947
+ let e = get_a_my_trait2 ( S1 ) . get_a ( ) ; // $ target=get_a_my_trait2 target=MyTrait::get_a MISSING: type=e:S1
1948
+ // For this function the `impl` type does not appear in the root of the return type
1949
+ let f = get_a_my_trait3 ( S1 ) . unwrap ( ) . get_a ( ) ; // $ target=get_a_my_trait3 target=unwrap MISSING: target=MyTrait::get_a type=f:S1
1930
1950
}
1931
1951
}
1932
1952
@@ -2385,7 +2405,7 @@ mod tuples {
2385
2405
2386
2406
let pair = [ 1 , 1 ] . into ( ) ; // $ type=pair:(T_2) type=pair:0(2).i32 type=pair:1(2).i32 MISSING: target=into
2387
2407
match pair {
2388
- ( 0 , 0 ) => print ! ( "unexpected" ) ,
2408
+ ( 0 , 0 ) => print ! ( "unexpected" ) ,
2389
2409
_ => print ! ( "expected" ) ,
2390
2410
}
2391
2411
let x = pair. 0 ; // $ type=x:i32
0 commit comments