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