2022-02-22 17:09:25 +00:00
|
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
//@ edition:2021
|
2023-10-16 15:39:13 +00:00
|
|
|
//@ check-pass
|
2023-08-07 14:49:44 +00:00
|
|
|
//@ revisions: tait rpit
|
2022-02-22 17:09:25 +00:00
|
|
|
|
|
|
|
struct Pending {}
|
|
|
|
|
|
|
|
struct CantOpen {}
|
|
|
|
|
|
|
|
trait AsyncRead {}
|
|
|
|
|
|
|
|
impl AsyncRead for i32 {}
|
|
|
|
|
|
|
|
type PendingReader<'a> = impl AsyncRead + 'a;
|
|
|
|
|
2023-08-07 14:49:44 +00:00
|
|
|
#[cfg(tait)]
|
|
|
|
type OpeningReadFuture<'a> = impl std::future::Future<Output = Result<PendingReader<'a>, CantOpen>>;
|
2022-02-22 17:09:25 +00:00
|
|
|
|
|
|
|
impl Pending {
|
|
|
|
async fn read(&mut self) -> Result<impl AsyncRead + '_, CantOpen> {
|
|
|
|
Ok(42)
|
|
|
|
}
|
|
|
|
|
2023-08-07 14:49:44 +00:00
|
|
|
#[cfg(tait)]
|
2022-02-22 17:09:25 +00:00
|
|
|
fn read_fut(&mut self) -> OpeningReadFuture<'_> {
|
2023-10-16 15:39:13 +00:00
|
|
|
self.read()
|
2023-08-07 14:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(rpit)]
|
|
|
|
fn read_fut(
|
|
|
|
&mut self,
|
|
|
|
) -> impl std::future::Future<Output = Result<PendingReader<'_>, CantOpen>> {
|
2022-02-22 17:09:25 +00:00
|
|
|
self.read()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|