File tree 4 files changed +73
-0
lines changed
src/test/ui/associated-types
4 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+ // check-pass
2
+
3
+ use std:: borrow:: Borrow ;
4
+
5
+ trait TNode : Sized {
6
+ type ConcreteElement : TElement < ConcreteNode = Self > ;
7
+ }
8
+
9
+ trait TElement : Sized {
10
+ type ConcreteNode : TNode < ConcreteElement = Self > ;
11
+ }
12
+
13
+ trait DomTraversal < N : TNode > {
14
+ type BorrowElement : Borrow < N :: ConcreteElement > ;
15
+ }
16
+
17
+ #[ allow( dead_code) ]
18
+ fn recalc_style_at < E , D > ( )
19
+ where
20
+ E : TElement ,
21
+ D : DomTraversal < E :: ConcreteNode > ,
22
+ {
23
+ }
24
+
25
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // check-pass
2
+
3
+ pub trait Test {
4
+ type Item ;
5
+ type Bundle : From < Self :: Item > ;
6
+ }
7
+
8
+ fn fails < T > ( )
9
+ where
10
+ T : Test < Item = String > ,
11
+ {
12
+ }
13
+
14
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // check-pass
2
+
3
+ trait Foo { type FooT : Foo ; }
4
+ impl Foo for ( ) { type FooT = ( ) ; }
5
+ trait Bar < T : Foo > { type BarT : Bar < T :: FooT > ; }
6
+ impl Bar < ( ) > for ( ) { type BarT = ( ) ; }
7
+
8
+ #[ allow( dead_code) ]
9
+ fn test < C : Bar < ( ) > > ( ) { }
10
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // check-pass
2
+
3
+ #![ feature( associated_type_bounds) ]
4
+ #![ feature( type_alias_impl_trait) ]
5
+
6
+ fn main ( ) { }
7
+
8
+ trait Bar { type Assoc ; }
9
+
10
+ trait Thing {
11
+ type Out ;
12
+ fn func ( ) -> Self :: Out ;
13
+ }
14
+
15
+ struct AssocIsCopy ;
16
+ impl Bar for AssocIsCopy { type Assoc = u8 ; }
17
+
18
+ impl Thing for AssocIsCopy {
19
+ type Out = impl Bar < Assoc : Copy > ;
20
+
21
+ fn func ( ) -> Self :: Out {
22
+ AssocIsCopy
23
+ }
24
+ }
You can’t perform that action at this time.
0 commit comments