@@ -406,12 +406,12 @@ mod impl_overlap {
406
406
impl OverlappingTrait for S1 {
407
407
// <S1_as_OverlappingTrait>::common_method
408
408
fn common_method ( self ) -> S1 {
409
- panic ! ( "not called" ) ;
409
+ S1
410
410
}
411
411
412
412
// <S1_as_OverlappingTrait>::common_method_2
413
413
fn common_method_2 ( self , s1 : S1 ) -> S1 {
414
- panic ! ( "not called" ) ;
414
+ S1
415
415
}
416
416
}
417
417
@@ -427,10 +427,78 @@ mod impl_overlap {
427
427
}
428
428
}
429
429
430
+ struct S2 < T2 > ( T2 ) ;
431
+
432
+ impl S2 < i32 > {
433
+ // S2<i32>::common_method
434
+ fn common_method ( self ) -> S1 {
435
+ S1
436
+ }
437
+
438
+ // S2<i32>::common_method
439
+ fn common_method_2 ( self ) -> S1 {
440
+ S1
441
+ }
442
+ }
443
+
444
+ impl OverlappingTrait for S2 < i32 > {
445
+ // <S2<i32>_as_OverlappingTrait>::common_method
446
+ fn common_method ( self ) -> S1 {
447
+ S1
448
+ }
449
+
450
+ // <S2<i32>_as_OverlappingTrait>::common_method_2
451
+ fn common_method_2 ( self , s1 : S1 ) -> S1 {
452
+ S1
453
+ }
454
+ }
455
+
456
+ impl OverlappingTrait for S2 < S1 > {
457
+ // <S2<S1>_as_OverlappingTrait>::common_method
458
+ fn common_method ( self ) -> S1 {
459
+ S1
460
+ }
461
+
462
+ // <S2<S1>_as_OverlappingTrait>::common_method_2
463
+ fn common_method_2 ( self , s1 : S1 ) -> S1 {
464
+ S1
465
+ }
466
+ }
467
+
468
+ #[ derive( Debug ) ]
469
+ struct S3 < T3 > ( T3 ) ;
470
+
471
+ trait OverlappingTrait2 < T > {
472
+ fn m ( & self , x : & T ) -> & Self ;
473
+ }
474
+
475
+ impl < T > OverlappingTrait2 < T > for S3 < T > {
476
+ // <S3<T>_as_OverlappingTrait2<T>>::m
477
+ fn m ( & self , x : & T ) -> & Self {
478
+ self
479
+ }
480
+ }
481
+
482
+ impl < T > S3 < T > {
483
+ // S3<T>::m
484
+ fn m ( & self , x : T ) -> & Self {
485
+ self
486
+ }
487
+ }
488
+
430
489
pub fn f ( ) {
431
490
let x = S1 ;
432
491
println ! ( "{:?}" , x. common_method( ) ) ; // $ method=S1::common_method
433
492
println ! ( "{:?}" , x. common_method_2( ) ) ; // $ method=S1::common_method_2
493
+
494
+ let y = S2 ( S1 ) ;
495
+ println ! ( "{:?}" , y. common_method( ) ) ; // $ method=<S2<S1>_as_OverlappingTrait>::common_method
496
+
497
+ let z = S2 ( 0 ) ;
498
+ println ! ( "{:?}" , z. common_method( ) ) ; // $ method=S2<i32>::common_method
499
+
500
+ let w = S3 ( S1 ) ;
501
+ println ! ( "{:?}" , w. m( x) ) ; // $ method=S3<T>::m
434
502
}
435
503
}
436
504
@@ -1959,22 +2027,25 @@ mod loops {
1959
2027
for s in & mut strings1 { } // $ MISSING: type=s:&T.str
1960
2028
for s in strings1 { } // $ type=s:str
1961
2029
1962
- let strings2 = [ // $ type=strings2:[T;...].String
2030
+ let strings2 = // $ type=strings2:[T;...].String
2031
+ [
1963
2032
String :: from ( "foo" ) ,
1964
2033
String :: from ( "bar" ) ,
1965
2034
String :: from ( "baz" ) ,
1966
2035
] ;
1967
2036
for s in strings2 { } // $ type=s:String
1968
2037
1969
- let strings3 = & [ // $ type=strings3:&T.[T;...].String
2038
+ let strings3 = // $ type=strings3:&T.[T;...].String
2039
+ & [
1970
2040
String :: from ( "foo" ) ,
1971
2041
String :: from ( "bar" ) ,
1972
2042
String :: from ( "baz" ) ,
1973
2043
] ;
1974
2044
for s in strings3 { } // $ MISSING: type=s:String
1975
2045
1976
2046
let callables = [ MyCallable :: new ( ) , MyCallable :: new ( ) , MyCallable :: new ( ) ] ; // $ MISSING: type=callables:[T;...].MyCallable; 3
1977
- for c in callables // $ type=c:MyCallable
2047
+ for c // $ type=c:MyCallable
2048
+ in callables
1978
2049
{
1979
2050
let result = c. call ( ) ; // $ type=result:i64 method=call
1980
2051
}
@@ -1986,7 +2057,8 @@ mod loops {
1986
2057
let range = 0 ..10 ; // $ MISSING: type=range:Range type=range:Idx.i32
1987
2058
for i in range { } // $ MISSING: type=i:i32
1988
2059
1989
- let range1 = std:: ops:: Range { // $ type=range1:Range type=range1:Idx.u16
2060
+ let range1 = // $ type=range1:Range type=range1:Idx.u16
2061
+ std:: ops:: Range {
1990
2062
start : 0u16 ,
1991
2063
end : 10u16 ,
1992
2064
} ;
@@ -2031,10 +2103,11 @@ mod loops {
2031
2103
// while loops
2032
2104
2033
2105
let mut a: i64 = 0 ; // $ type=a:i64
2034
- while a < 10 // $ method=lt type=a:i64
2106
+ #[ rustfmt:: skip]
2107
+ let _ = while a < 10 // $ method=lt type=a:i64
2035
2108
{
2036
2109
a += 1 ; // $ type=a:i64 method=add_assign
2037
- }
2110
+ } ;
2038
2111
}
2039
2112
}
2040
2113
0 commit comments