File tree Expand file tree Collapse file tree 4 files changed +74
-0
lines changed
src/test/ui/type-alias-impl-trait Expand file tree Collapse file tree 4 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 1+ // ignore-tidy-linelength
2+ #![ feature( type_alias_impl_trait) ]
3+
4+ use std:: fmt:: Debug ;
5+
6+ pub trait Foo {
7+ type Item : Debug ;
8+
9+ fn foo < T : Debug > ( _: T ) -> Self :: Item ;
10+ }
11+
12+ #[ derive( Debug ) ]
13+ pub struct S < T > ( std:: marker:: PhantomData < T > ) ;
14+
15+ pub struct S2 ;
16+
17+ impl Foo for S2 {
18+ type Item = impl Debug ;
19+
20+ fn foo < T : Debug > ( _: T ) -> Self :: Item {
21+ //~^ Error type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
22+ S :: < T > ( Default :: default ( ) )
23+ }
24+ }
25+
26+ fn main ( ) {
27+ S2 :: foo ( 123 ) ;
28+ }
Original file line number Diff line number Diff line change 1+ error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
2+ --> $DIR/issue-53598.rs:20:42
3+ |
4+ LL | fn foo<T: Debug>(_: T) -> Self::Item {
5+ | __________________________________________^
6+ LL | |
7+ LL | | S::<T>(Default::default())
8+ LL | | }
9+ | |_____^
10+
11+ error: aborting due to previous error
12+
Original file line number Diff line number Diff line change 1+ // ignore-tidy-linelength
2+ #![ feature( arbitrary_self_types) ]
3+ #![ feature( type_alias_impl_trait) ]
4+
5+ use std:: ops:: Deref ;
6+
7+ trait Foo {
8+ type Bar : Foo ;
9+
10+ fn foo ( self : impl Deref < Target = Self > ) -> Self :: Bar ;
11+ }
12+
13+ impl < C > Foo for C {
14+ type Bar = impl Foo ;
15+
16+ fn foo ( self : impl Deref < Target = Self > ) -> Self :: Bar {
17+ //~^ Error type parameter `impl Deref<Target = Self>` is part of concrete type but not used in parameter list for the `impl Trait` type alias
18+ self
19+ }
20+ }
21+
22+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error: type parameter `impl Deref<Target = Self>` is part of concrete type but not used in parameter list for the `impl Trait` type alias
2+ --> $DIR/issue-57700.rs:16:58
3+ |
4+ LL | fn foo(self: impl Deref<Target = Self>) -> Self::Bar {
5+ | __________________________________________________________^
6+ LL | |
7+ LL | | self
8+ LL | | }
9+ | |_____^
10+
11+ error: aborting due to previous error
12+
You can’t perform that action at this time.
0 commit comments