Skip to content

Commit 5457db9

Browse files
committed
add non-regression test for issue 105809
1 parent 8275d11 commit 5457db9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/test/ui/mir/issue-105809.rs

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Non-regression test ICE from issue #105809 and duplicates.
2+
3+
// build-pass: the ICE is during codegen
4+
// compile-flags: --edition 2018 -Zmir-opt-level=1
5+
6+
use std::{future::Future, pin::Pin};
7+
8+
// Create a `T` without affecting analysis like `loop {}`.
9+
fn create<T>() -> T {
10+
loop {}
11+
}
12+
13+
async fn trivial_future() {}
14+
15+
struct Connection<H> {
16+
_h: H,
17+
}
18+
19+
async fn complex_future<H>(conn: &Connection<H>) {
20+
let small_fut = async move {
21+
let _ = conn;
22+
trivial_future().await;
23+
};
24+
25+
let mut tuple = (small_fut,);
26+
let (small_fut_again,) = &mut tuple;
27+
let _ = small_fut_again;
28+
}
29+
30+
fn main() {
31+
let mut fut = complex_future(&Connection { _h: () });
32+
33+
let mut cx = create();
34+
let future = unsafe { Pin::new_unchecked(&mut fut) };
35+
let _ = future.poll(&mut cx);
36+
}

0 commit comments

Comments
 (0)