File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed
tests/ui/associated-type-bounds Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ #![ feature( associated_type_bounds) ]
4+
5+ trait A < ' a > {
6+ type Assoc : ?Sized ;
7+ }
8+
9+ impl < ' a > A < ' a > for ( ) {
10+ type Assoc = & ' a ( ) ;
11+ }
12+
13+ fn hello ( ) -> impl for < ' a > A < ' a , Assoc : Sized > {
14+ ( )
15+ }
16+
17+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ #![ feature( associated_type_bounds) ]
4+
5+ trait Trait1 {
6+ type Assoc1 : Bar ;
7+
8+ fn assoc ( self ) -> Self :: Assoc1 ;
9+ }
10+
11+ impl Trait1 for ( ) {
12+ type Assoc1 = ( ) ;
13+ fn assoc ( self ) { }
14+ }
15+
16+ trait Foo { }
17+ impl Foo for ( ) { }
18+ trait Bar { }
19+ impl Bar for ( ) { }
20+
21+ fn hello ( ) -> impl Trait1 < Assoc1 : Foo > {
22+ ( )
23+ }
24+
25+ fn world ( ) {
26+ // Tests that `Assoc1: Foo` bound in the RPIT doesn't disqualify
27+ // the `Assoc1: Bar` bound in the item, as a nested RPIT desugaring
28+ // would do.
29+
30+ fn is_foo ( _: impl Foo ) { }
31+ is_foo ( hello ( ) . assoc ( ) ) ;
32+
33+ fn is_bar ( _: impl Bar ) { }
34+ is_bar ( hello ( ) . assoc ( ) ) ;
35+ }
36+
37+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments