diff options
| author | Rémy Rakic <remy.rakic+github@gmail.com> | 2022-12-19 15:41:36 +0000 |
|---|---|---|
| committer | Rémy Rakic <remy.rakic+github@gmail.com> | 2022-12-19 18:27:13 +0000 |
| commit | 5457db94108b3c3ca75e1875b7e60bc4ea6b4b66 (patch) | |
| tree | 3bee9b02ad4a38ce52e554b21024602e7455f481 | |
| parent | 8275d115fbc86a95a483fe3a344387b8b3883a83 (diff) | |
| download | rust-5457db94108b3c3ca75e1875b7e60bc4ea6b4b66.tar.gz rust-5457db94108b3c3ca75e1875b7e60bc4ea6b4b66.zip | |
add non-regression test for issue 105809
| -rw-r--r-- | src/test/ui/mir/issue-105809.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/ui/mir/issue-105809.rs b/src/test/ui/mir/issue-105809.rs new file mode 100644 index 00000000000..57828feef2d --- /dev/null +++ b/src/test/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); +} |
