File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ //@ check-pass
2+
3+ #![ deny( dead_code) ]
4+
5+ trait Tr {
6+ type A ;
7+ type B ;
8+ type C : Default ;
9+ type D ;
10+ type E ;
11+ type F ;
12+ type G ;
13+ type H ;
14+ }
15+
16+ impl Tr for i32 {
17+ type A = Self ;
18+ type B = Self ;
19+ type C = Self ;
20+ type D = Self ;
21+ type E = Self ;
22+ type F = Self ;
23+ type G = Self ;
24+ type H = Self ;
25+ }
26+
27+ trait Tr2 {
28+ type A ;
29+ }
30+
31+ impl Tr2 for i32 {
32+ type A = Self ;
33+ }
34+
35+ struct Foo < T : Tr2 > {
36+ _x : T :: A ,
37+ }
38+
39+ struct Bar < T > {
40+ _x : T
41+ }
42+
43+ impl < T > Bar < T >
44+ where
45+ T : Tr2 < A = i32 >
46+ { }
47+
48+ type Baz < T > = <T as Tr >:: G ;
49+
50+ struct FooBaz < T : Tr > {
51+ _x : Baz < T > ,
52+ }
53+
54+ fn foo < T : Tr > ( t : impl Tr < A = T > ) -> impl Tr
55+ where
56+ T :: B : Copy
57+ {
58+ let _a: T :: C = Default :: default ( ) ;
59+ baz :: < T :: F > ( ) ;
60+ t
61+ }
62+ fn bar < T : ?Sized > ( ) { }
63+ fn baz < T > ( ) { }
64+
65+ fn main ( ) {
66+ foo :: < i32 > ( 42 ) ;
67+ bar :: < dyn Tr2 < A = i32 > > ( ) ;
68+ let _d: <i32 as Tr >:: D = Default :: default ( ) ;
69+ baz :: < <i32 as Tr >:: E > ( ) ;
70+ baz :: < Foo < i32 > > ( ) ;
71+ baz :: < Bar < i32 > > ( ) ;
72+ baz :: < FooBaz < i32 > > ( ) ;
73+ }
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+
3+ #![ deny( dead_code) ]
4+
5+ trait Trait { type Ty ; }
6+
7+ impl Trait for ( ) { type Ty = ( ) ; }
8+
9+ pub struct Wrap ( Inner < ( ) > ) ;
10+ struct Inner < T : Trait > ( T :: Ty ) ; // <- use of QPath::TypeRelative `Ty` in a non-body only
11+
12+ impl Wrap {
13+ pub fn live ( self ) { _ = self . 0 ; }
14+ }
15+
16+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+
3+ #![ deny( dead_code) ]
4+
5+ pub struct A ;
6+
7+ trait B {
8+ type Assoc ;
9+ }
10+
11+ impl B for A {
12+ type Assoc = A ;
13+ }
14+
15+ const X : <A as B >:: Assoc = A ;
16+
17+ fn main ( ) {
18+ let _x: A = X ;
19+ }
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+
3+ #![ deny( dead_code) ]
4+
5+ pub struct A ;
6+
7+ trait B {
8+ type Assoc ;
9+ }
10+
11+ impl B for A {
12+ type Assoc = A ;
13+ }
14+
15+ trait C { }
16+
17+ impl C for <A as B >:: Assoc { }
18+
19+ fn foo < T : C > ( ) { }
20+
21+ fn main ( ) {
22+ foo :: < A > ( ) ;
23+ }
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+
3+ #![ feature( inherent_associated_types) ]
4+ #![ allow( incomplete_features) ]
5+ #[ deny( dead_code) ]
6+
7+ fn main ( ) {
8+ let _: Struct :: Item = ( ) ;
9+ }
10+
11+ struct Struct ;
12+ impl Struct { type Item = ( ) ; }
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+
3+ #![ deny( dead_code) ]
4+
5+ trait Tr {
6+ type X ;
7+ }
8+
9+ struct T ;
10+
11+ impl Tr for T {
12+ type X = Self ;
13+ }
14+
15+ fn foo < T : Tr > ( ) where {
16+ let _: T :: X ;
17+ }
18+
19+ fn main ( ) {
20+ foo :: < T > ( ) ;
21+ }
You can’t perform that action at this time.
0 commit comments