summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/await-into-future.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await/await-into-future.rs')
-rw-r--r--tests/ui/async-await/await-into-future.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/async-await/await-into-future.rs b/tests/ui/async-await/await-into-future.rs
new file mode 100644
index 000000000..8bf1385b3
--- /dev/null
+++ b/tests/ui/async-await/await-into-future.rs
@@ -0,0 +1,28 @@
+// run-pass
+// aux-build: issue-72470-lib.rs
+// edition:2021
+extern crate issue_72470_lib;
+use std::{future::{Future, IntoFuture}, pin::Pin};
+
+struct AwaitMe;
+
+impl IntoFuture for AwaitMe {
+ type Output = i32;
+ type IntoFuture = Pin<Box<dyn Future<Output = i32>>>;
+
+ fn into_future(self) -> Self::IntoFuture {
+ Box::pin(me())
+ }
+}
+
+async fn me() -> i32 {
+ 41
+}
+
+async fn run() {
+ assert_eq!(AwaitMe.await, 41);
+}
+
+fn main() {
+ issue_72470_lib::run(run());
+}