File tree 2 files changed +52
-0
lines changed
tests/ui/type-alias-impl-trait
2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ // edition: 2021
2
+
3
+ #![ feature( impl_trait_in_assoc_type) ]
4
+
5
+ use std:: future:: Future ;
6
+
7
+ pub struct MemtableLocalStateStore {
8
+ mem_table : MemTable ,
9
+ }
10
+
11
+ impl LocalStateStore for MemtableLocalStateStore {
12
+ type IterStream < ' a > = impl Sized + ' a where Self : ' a ;
13
+
14
+ fn iter ( & self ) -> impl Future < Output = Self :: IterStream < ' _ > > + ' _ {
15
+ async move { merge_stream ( self . mem_table . iter ( ) ) }
16
+ }
17
+ }
18
+
19
+ trait LocalStateStore {
20
+ type IterStream < ' a >
21
+ where
22
+ Self : ' a ;
23
+
24
+ fn iter ( & self ) -> impl Future < Output = Self :: IterStream < ' _ > > + ' _ ;
25
+ }
26
+
27
+ struct MemTable ;
28
+
29
+ impl MemTable {
30
+ fn iter < ' a > ( & ' a self ) -> impl Iterator < Item = & ' a ( ) > {
31
+ std:: iter:: empty ( )
32
+ }
33
+ }
34
+
35
+ pub ( crate ) async fn merge_stream < ' a > ( mem_table_iter : impl Iterator < Item = & ' a ( ) > ) { }
36
+
37
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0792]: non-defining opaque type use in defining scope
2
+ --> $DIR/nested_impl_trait_in_assoc_ty.rs:15:9
3
+ |
4
+ LL | async move { merge_stream(self.mem_table.iter()) }
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument `'_` is not a generic parameter
6
+ |
7
+ note: for this opaque type
8
+ --> $DIR/nested_impl_trait_in_assoc_ty.rs:35:1
9
+ |
10
+ LL | pub(crate) async fn merge_stream<'a>(mem_table_iter: impl Iterator<Item = &'a ()>) {}
11
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
+
13
+ error: aborting due to previous error
14
+
15
+ For more information about this error, try `rustc --explain E0792`.
You can’t perform that action at this time.
0 commit comments