@@ -14,7 +14,7 @@ mod field_access {
14
14
}
15
15
16
16
#[ derive( Debug ) ]
17
- struct GenericThing < A > {
17
+ struct GenericThing < A = bool > {
18
18
a : A ,
19
19
}
20
20
@@ -27,6 +27,11 @@ mod field_access {
27
27
println ! ( "{:?}" , x. a) ; // $ fieldof=MyThing
28
28
}
29
29
30
+ fn default_field_access ( x : GenericThing ) {
31
+ let a = x. a ; // $ fieldof=GenericThing MISSING: type=a:bool
32
+ println ! ( "{:?}" , a) ;
33
+ }
34
+
30
35
fn generic_field_access ( ) {
31
36
// Explicit type argument
32
37
let x = GenericThing :: < S > { a : S } ; // $ type=x:A.S
@@ -472,16 +477,16 @@ mod type_parameter_bounds {
472
477
println ! ( "{:?}" , s) ; // $ type=s:S1
473
478
}
474
479
475
- trait Pair < P1 , P2 > {
480
+ trait Pair < P1 = bool , P2 = i64 > {
476
481
fn fst ( self ) -> P1 ;
477
482
478
483
fn snd ( self ) -> P2 ;
479
484
}
480
485
481
486
fn call_trait_per_bound_with_type_1 < T : Pair < S1 , S2 > > ( x : T , y : T ) {
482
487
// 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
485
490
println ! ( "{:?}, {:?}" , s1, s2) ;
486
491
}
487
492
@@ -491,6 +496,20 @@ mod type_parameter_bounds {
491
496
let s2 = y. snd ( ) ; // $ method=snd
492
497
println ! ( "{:?}, {:?}" , s1, s2) ;
493
498
}
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
+ }
494
513
}
495
514
496
515
mod function_trait_bounds {
0 commit comments