diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
commit | a4b7ed7a42c716ab9f05e351f003d589124fd55d (patch) | |
tree | b620cd3f223850b28716e474e80c58059dca5dd4 /tests/ui/mir/issue-105809.rs | |
parent | Adding upstream version 1.67.1+dfsg1. (diff) | |
download | rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip |
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/mir/issue-105809.rs')
-rw-r--r-- | tests/ui/mir/issue-105809.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/ui/mir/issue-105809.rs b/tests/ui/mir/issue-105809.rs new file mode 100644 index 000000000..57828feef --- /dev/null +++ b/tests/ui/mir/issue-105809.rs @@ -0,0 +1,36 @@ +// Non-regression test ICE from issue #105809 and duplicates. + +// build-pass: the ICE is during codegen +// compile-flags: --edition 2018 -Zmir-opt-level=1 + +use std::{future::Future, pin::Pin}; + +// Create a `T` without affecting analysis like `loop {}`. +fn create<T>() -> T { + loop {} +} + +async fn trivial_future() {} + +struct Connection<H> { + _h: H, +} + +async fn complex_future<H>(conn: &Connection<H>) { + let small_fut = async move { + let _ = conn; + trivial_future().await; + }; + + let mut tuple = (small_fut,); + let (small_fut_again,) = &mut tuple; + let _ = small_fut_again; +} + +fn main() { + let mut fut = complex_future(&Connection { _h: () }); + + let mut cx = create(); + let future = unsafe { Pin::new_unchecked(&mut fut) }; + let _ = future.poll(&mut cx); +} |