]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/await-into-future.rs
Rollup merge of #94006 - pierwill:upvar-field, r=nikomatsakis
[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 #![feature(into_future)]
5
6 extern crate issue_72470_lib;
7 use std::{future::{Future, IntoFuture}, pin::Pin};
8
9 struct AwaitMe;
10
11 impl IntoFuture for AwaitMe {
12     type Output = i32;
13     type Future = Pin<Box<dyn Future<Output = i32>>>;
14
15     fn into_future(self) -> Self::Future {
16         Box::pin(me())
17     }
18 }
19
20 async fn me() -> i32 {
21     41
22 }
23
24 async fn run() {
25     assert_eq!(AwaitMe.await, 41);
26 }
27
28 fn main() {
29     issue_72470_lib::run(run());
30 }