2021-12-02 13:36:48 -06:00
|
|
|
// run-pass
|
|
|
|
// aux-build: issue-72470-lib.rs
|
2021-11-09 12:08:38 -06:00
|
|
|
// edition:2021
|
2021-12-02 13:36:48 -06:00
|
|
|
extern crate issue_72470_lib;
|
2021-11-09 12:08:38 -06:00
|
|
|
use std::{future::{Future, IntoFuture}, pin::Pin};
|
|
|
|
|
|
|
|
struct AwaitMe;
|
|
|
|
|
|
|
|
impl IntoFuture for AwaitMe {
|
|
|
|
type Output = i32;
|
2022-03-10 13:29:35 -06:00
|
|
|
type IntoFuture = Pin<Box<dyn Future<Output = i32>>>;
|
2021-11-09 12:08:38 -06:00
|
|
|
|
2022-03-10 13:29:35 -06:00
|
|
|
fn into_future(self) -> Self::IntoFuture {
|
2021-11-09 12:08:38 -06:00
|
|
|
Box::pin(me())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async fn me() -> i32 {
|
|
|
|
41
|
|
|
|
}
|
|
|
|
|
|
|
|
async fn run() {
|
|
|
|
assert_eq!(AwaitMe.await, 41);
|
|
|
|
}
|
|
|
|
|
2021-12-02 13:36:48 -06:00
|
|
|
fn main() {
|
|
|
|
issue_72470_lib::run(run());
|
|
|
|
}
|