We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8d6472a commit 7fe24a2Copy full SHA for 7fe24a2
tests/run-pass-fullmir/async-fn.rs
@@ -0,0 +1,35 @@
1
+#![feature(
2
+ async_await,
3
+ await_macro,
4
+ futures_api,
5
+ pin,
6
+)]
7
+
8
+use std::{future::Future, pin::Pin, task::Poll};
9
10
+// See if we can run a basic `async fn`
11
+pub async fn foo(x: &u32, y: u32) -> u32 {
12
+ let y = &y;
13
+ let z = 9;
14
+ let z = &z;
15
+ let y = await!(async { *y + *z });
16
+ let a = 10;
17
+ let a = &a;
18
+ *x + y + *a
19
+}
20
21
+fn main() {
22
+ use std::{sync::Arc, task::{Wake, local_waker}};
23
24
+ struct NoWake;
25
+ impl Wake for NoWake {
26
+ fn wake(_arc_self: &Arc<Self>) {
27
+ panic!();
28
+ }
29
30
31
+ let lw = unsafe { local_waker(Arc::new(NoWake)) };
32
+ let x = 5;
33
+ let mut fut = foo(&x, 7);
34
+ assert_eq!(unsafe { Pin::new_unchecked(&mut fut) }.poll(&lw), Poll::Ready(31));
35
0 commit comments