@@ -1042,6 +1042,23 @@ mod type_aliases {
1042
1042
1043
1043
type S7 < T7 > = Result < S6 < T7 > , S1 > ;
1044
1044
1045
+ struct GenS < GenT > ( GenT ) ;
1046
+
1047
+ trait TraitWithAssocType {
1048
+ type Output ;
1049
+ fn get_input ( self ) -> Self :: Output ;
1050
+ }
1051
+
1052
+ impl < Output > TraitWithAssocType for GenS < Output > {
1053
+ // This is not a recursive type, the `Output` on the right-hand side
1054
+ // refers to the type parameter of the impl block just above.
1055
+ type Output = Result < Output , Output > ;
1056
+
1057
+ fn get_input ( self ) -> Self :: Output {
1058
+ Ok ( self . 0 ) // $ fieldof=GenS type=Ok(...):Result type=Ok(...):T.Output type=Ok(...):E.Output
1059
+ }
1060
+ }
1061
+
1045
1062
pub fn f ( ) {
1046
1063
// Type can be inferred from the constructor
1047
1064
let p1: MyPair = PairOption :: PairBoth ( S1 , S2 ) ;
@@ -1062,6 +1079,8 @@ mod type_aliases {
1062
1079
g ( PairOption :: PairSnd ( PairOption :: PairSnd ( S3 ) ) ) ; // $ target=g
1063
1080
1064
1081
let x: S7 < S2 > ; // $ type=x:Result $ type=x:E.S1 $ type=x:T.S4 $ type=x:T.T41.S2 $ type=x:T.T42.S5 $ type=x:T.T42.T5.S2
1082
+
1083
+ let y = GenS ( true ) . get_input ( ) ; // $ type=y:Result type=y:T.bool type=y:E.bool target=get_input
1065
1084
}
1066
1085
}
1067
1086
@@ -2006,7 +2025,11 @@ mod method_determined_by_argument_type {
2006
2025
2007
2026
// MyAdd<bool>::my_add
2008
2027
fn my_add ( self , value : bool ) -> Self {
2009
- if value { 1 } else { 0 }
2028
+ if value {
2029
+ 1
2030
+ } else {
2031
+ 0
2032
+ }
2010
2033
}
2011
2034
}
2012
2035
@@ -2057,7 +2080,11 @@ mod method_determined_by_argument_type {
2057
2080
impl MyFrom < bool > for i64 {
2058
2081
// MyFrom<bool>::my_from
2059
2082
fn my_from ( value : bool ) -> Self {
2060
- if value { 1 } else { 0 }
2083
+ if value {
2084
+ 1
2085
+ } else {
2086
+ 0
2087
+ }
2061
2088
}
2062
2089
}
2063
2090
@@ -2407,7 +2434,7 @@ mod closures {
2407
2434
Some ( 1 ) . map ( |x| {
2408
2435
let x = x; // $ MISSING: type=x:i32
2409
2436
println ! ( "{x}" ) ;
2410
- } ) ; // $ target=map
2437
+ } ) ; // $ target=map
2411
2438
2412
2439
let table = Table :: new ( ) ; // $ target=new type=table:Table
2413
2440
let result = table. count_with ( |row| // $ type=result:i64
0 commit comments