File tree Expand file tree Collapse file tree 4 files changed +72
-0
lines changed
src/test/ui/generic-associated-types Expand file tree Collapse file tree 4 files changed +72
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ feature( type_alias_impl_trait) ]
2+ #![ feature( generic_associated_types) ]
3+
4+ // See https://github.com/rust-lang/rust/issues/87258#issuecomment-883293367
5+
6+ trait Trait1 { }
7+
8+ struct Struct < ' b > ( & ' b ( ) ) ;
9+
10+ impl < ' d > Trait1 for Struct < ' d > { }
11+
12+ pub trait Trait2 {
13+ type FooFuture < ' a > : Trait1 ;
14+ fn foo < ' a > ( ) -> Self :: FooFuture < ' a > ;
15+ }
16+
17+ impl < ' c , S : Trait2 > Trait2 for & ' c mut S {
18+ type FooFuture < ' a > = impl Trait1 ;
19+ fn foo < ' a > ( ) -> Self :: FooFuture < ' a > { //~ ERROR
20+ Struct ( unimplemented ! ( ) )
21+ }
22+ }
23+
24+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2+ --> $DIR/issue-87258_a.rs:19:21
3+ |
4+ LL | fn foo<'a>() -> Self::FooFuture<'a> {
5+ | ^^^^^^^^^^^^^^^^^^^
6+ |
7+ = note: hidden type `Struct<'_>` captures lifetime '_#7r
8+
9+ error: aborting due to previous error
10+
11+ For more information about this error, try `rustc --explain E0700`.
Original file line number Diff line number Diff line change 1+ #![ feature( type_alias_impl_trait) ]
2+ #![ feature( generic_associated_types) ]
3+
4+ // See https://github.com/rust-lang/rust/issues/87258#issuecomment-883293367
5+
6+ trait Trait1 { }
7+
8+ struct Struct < ' b > ( & ' b ( ) ) ;
9+
10+ impl < ' d > Trait1 for Struct < ' d > { }
11+
12+ pub trait Trait2 {
13+ type FooFuture < ' a > : Trait1 ;
14+ fn foo < ' a > ( ) -> Self :: FooFuture < ' a > ;
15+ }
16+
17+ type Helper < ' xenon , ' yttrium , KABOOM : Trait2 > = impl Trait1 ;
18+
19+ impl < ' c , S : Trait2 > Trait2 for & ' c mut S {
20+ type FooFuture < ' a > = Helper < ' c , ' a , S > ;
21+ fn foo < ' a > ( ) -> Self :: FooFuture < ' a > { //~ ERROR
22+ Struct ( unimplemented ! ( ) )
23+ }
24+ }
25+
26+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2+ --> $DIR/issue-87258_b.rs:21:21
3+ |
4+ LL | fn foo<'a>() -> Self::FooFuture<'a> {
5+ | ^^^^^^^^^^^^^^^^^^^
6+ |
7+ = note: hidden type `Struct<'_>` captures lifetime '_#7r
8+
9+ error: aborting due to previous error
10+
11+ For more information about this error, try `rustc --explain E0700`.
You can’t perform that action at this time.
0 commit comments