@@ -14,7 +14,7 @@ mod field_access {
1414 }
1515
1616 #[ derive( Debug ) ]
17- struct GenericThing < A > {
17+ struct GenericThing < A = bool > {
1818 a : A ,
1919 }
2020
@@ -27,6 +27,11 @@ mod field_access {
2727 println ! ( "{:?}" , x. a) ; // $ fieldof=MyThing
2828 }
2929
30+ fn default_field_access ( x : GenericThing ) {
31+ let a = x. a ; // $ fieldof=GenericThing MISSING: type=a:bool
32+ println ! ( "{:?}" , a) ;
33+ }
34+
3035 fn generic_field_access ( ) {
3136 // Explicit type argument
3237 let x = GenericThing :: < S > { a : S } ; // $ type=x:A.S
@@ -472,16 +477,16 @@ mod type_parameter_bounds {
472477 println ! ( "{:?}" , s) ; // $ type=s:S1
473478 }
474479
475- trait Pair < P1 , P2 > {
480+ trait Pair < P1 = bool , P2 = i64 > {
476481 fn fst ( self ) -> P1 ;
477482
478483 fn snd ( self ) -> P2 ;
479484 }
480485
481486 fn call_trait_per_bound_with_type_1 < T : Pair < S1 , S2 > > ( x : T , y : T ) {
482487 // The type in the type parameter bound determines the return type.
483- let s1 = x. fst ( ) ; // $ method=fst
484- let s2 = y. snd ( ) ; // $ method=snd
488+ let s1 = x. fst ( ) ; // $ method=fst type=s1:S1
489+ let s2 = y. snd ( ) ; // $ method=snd type=s2:S2
485490 println ! ( "{:?}, {:?}" , s1, s2) ;
486491 }
487492
@@ -491,6 +496,20 @@ mod type_parameter_bounds {
491496 let s2 = y. snd ( ) ; // $ method=snd
492497 println ! ( "{:?}, {:?}" , s1, s2) ;
493498 }
499+
500+ fn call_trait_per_bound_with_type_3 < T : Pair > ( x : T , y : T ) {
501+ // The type in the type parameter bound determines the return type.
502+ let s1 = x. fst ( ) ; // $ method=fst MISSING: type=s1:bool
503+ let s2 = y. snd ( ) ; // $ method=snd MISSING: type=s2:i64
504+ println ! ( "{:?}, {:?}" , s1, s2) ;
505+ }
506+
507+ fn call_trait_per_bound_with_type_4 < T : Pair < u8 > > ( x : T , y : T ) {
508+ // The type in the type parameter bound determines the return type.
509+ let s1 = x. fst ( ) ; // $ method=fst type=s1:u8
510+ let s2 = y. snd ( ) ; // $ method=snd MISSING: type=s2:i64
511+ println ! ( "{:?}, {:?}" , s1, s2) ;
512+ }
494513}
495514
496515mod function_trait_bounds {
0 commit comments