Add regression test

This commit is contained in:
Oli Scherer 2023-10-30 13:38:54 +00:00
parent e324cf0f73
commit 972ee01b69
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,37 @@
// edition: 2021
#![feature(impl_trait_in_assoc_type)]
use std::future::Future;
pub struct MemtableLocalStateStore {
mem_table: MemTable,
}
impl LocalStateStore for MemtableLocalStateStore {
type IterStream<'a> = impl Sized + 'a where Self: 'a;
fn iter(&self) -> impl Future<Output = Self::IterStream<'_>> + '_ {
async move { merge_stream(self.mem_table.iter()) }
}
}
trait LocalStateStore {
type IterStream<'a>
where
Self: 'a;
fn iter(&self) -> impl Future<Output = Self::IterStream<'_>> + '_;
}
struct MemTable;
impl MemTable {
fn iter<'a>(&'a self) -> impl Iterator<Item = &'a ()> {
std::iter::empty()
}
}
pub(crate) async fn merge_stream<'a>(mem_table_iter: impl Iterator<Item = &'a ()>) {}
fn main() {}

View File

@ -0,0 +1,15 @@
error[E0792]: non-defining opaque type use in defining scope
--> $DIR/nested_impl_trait_in_assoc_ty.rs:15:9
|
LL | async move { merge_stream(self.mem_table.iter()) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument `'_` is not a generic parameter
|
note: for this opaque type
--> $DIR/nested_impl_trait_in_assoc_ty.rs:35:1
|
LL | pub(crate) async fn merge_stream<'a>(mem_table_iter: impl Iterator<Item = &'a ()>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0792`.