]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/await-into-future.rs
Rollup merge of #103570 - lukas-code:stabilize-ilog, r=scottmcm
[rust.git] / src / test / ui / async-await / await-into-future.rs
1 // run-pass
2 // aux-build: issue-72470-lib.rs
3 // edition:2021
4 extern crate issue_72470_lib;
5 use std::{future::{Future, IntoFuture}, pin::Pin};
6
7 struct AwaitMe;
8
9 impl IntoFuture for AwaitMe {
10     type Output = i32;
11     type IntoFuture = Pin<Box<dyn Future<Output = i32>>>;
12
13     fn into_future(self) -> Self::IntoFuture {
14         Box::pin(me())
15     }
16 }
17
18 async fn me() -> i32 {
19     41
20 }
21
22 async fn run() {
23     assert_eq!(AwaitMe.await, 41);
24 }
25
26 fn main() {
27     issue_72470_lib::run(run());
28 }