diff options
| author | Andrew Zhogin <andrew.zhogin@gmail.com> | 2025-05-11 02:21:56 +0700 |
|---|---|---|
| committer | Andrew Zhogin <andrew.zhogin@gmail.com> | 2025-05-11 03:48:50 +0700 |
| commit | 13178c75cea866d3a84a570b9ae984508c2127db (patch) | |
| tree | f563a0b1fb508caa2c4a3d44bd2ffa73c5709c6d /tests/ui/async-await/async-drop | |
| parent | b10555674f355aca2bfe974e50a0b9ab48eb1d87 (diff) | |
| download | rust-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.rs | 21 |
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; +} |
