about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-03-08 01:34:05 +0000
committerMichael Goulet <michael@errs.io>2024-03-22 17:15:22 -0400
commitda8a39a9de150f6b63a0601b4295e4b5a4f74e12 (patch)
tree4ac2aca7ab31d4bbb71e16037e7d6ba05c0da8c0
parentb3df0d7e5ef5f7dbeeca3fb289c65680ad013f87 (diff)
downloadrust-da8a39a9de150f6b63a0601b4295e4b5a4f74e12.tar.gz
rust-da8a39a9de150f6b63a0601b4295e4b5a4f74e12.zip
Failing test
-rw-r--r--tests/mir-opt/inline_coroutine_body.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/mir-opt/inline_coroutine_body.rs b/tests/mir-opt/inline_coroutine_body.rs
new file mode 100644
index 00000000000..5c305c55100
--- /dev/null
+++ b/tests/mir-opt/inline_coroutine_body.rs
@@ -0,0 +1,28 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// skip-filecheck
+//@ unit-test: Inline
+//@ edition: 2021
+//@ compile-flags: -Zinline-mir-hint-threshold=10000 -Zinline-mir-threshold=10000 --crate-type=lib
+
+pub async fn run(permit: ActionPermit<'_, ()>, ctx: &mut core::task::Context<'_>) {
+    run2(permit, ctx);
+}
+
+// EMIT_MIR inline_coroutine_body.run2.Inline.diff
+fn run2<T>(permit: ActionPermit<'_, T>, ctx: &mut core::task::Context) {
+    _ = || {
+        let mut fut = ActionPermit::perform(permit);
+        let fut = unsafe { core::pin::Pin::new_unchecked(&mut fut) };
+        _ = core::future::Future::poll(fut, ctx);
+    };
+}
+
+pub struct ActionPermit<'a, T> {
+    _guard: core::cell::Ref<'a, T>,
+}
+
+impl<'a, T> ActionPermit<'a, T> {
+    async fn perform(self) {
+        core::future::ready(()).await
+    }
+}