about summary refs log tree commit diff
path: root/tests/ui/async-await/async-drop
diff options
context:
space:
mode:
authorAndrew Zhogin <andrew.zhogin@gmail.com>2025-05-11 02:21:56 +0700
committerAndrew Zhogin <andrew.zhogin@gmail.com>2025-05-11 03:48:50 +0700
commit13178c75cea866d3a84a570b9ae984508c2127db (patch)
treef563a0b1fb508caa2c4a3d44bd2ffa73c5709c6d /tests/ui/async-await/async-drop
parentb10555674f355aca2bfe974e50a0b9ab48eb1d87 (diff)
downloadrust-13178c75cea866d3a84a570b9ae984508c2127db.tar.gz
rust-13178c75cea866d3a84a570b9ae984508c2127db.zip
Async drop fix for async_drop_in_place<T> layout calculated for unspecified T
Diffstat (limited to 'tests/ui/async-await/async-drop')
-rw-r--r--tests/ui/async-await/async-drop/open-drop-error.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/async-await/async-drop/open-drop-error.rs b/tests/ui/async-await/async-drop/open-drop-error.rs
new file mode 100644
index 00000000000..1d97eee5210
--- /dev/null
+++ b/tests/ui/async-await/async-drop/open-drop-error.rs
@@ -0,0 +1,21 @@
+//@ compile-flags: -Zmir-enable-passes=+DataflowConstProp
+//@ edition: 2021
+//@ build-pass
+#![feature(async_drop)]
+#![allow(incomplete_features)]
+
+use std::mem::ManuallyDrop;
+use std::{
+    future::async_drop_in_place,
+    pin::{pin, Pin},
+};
+fn main() {
+    a(b)
+}
+fn b() {}
+fn a<C>(d: C) {
+    let e = pin!(ManuallyDrop::new(d));
+    let f = unsafe { Pin::map_unchecked_mut(e, |g| &mut **g) };
+    let h = unsafe { async_drop_in_place(f.get_unchecked_mut()) };
+    h;
+}