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 {}`. create<T>() -> T9fn create<T>() -> T { 10 loop {} 11 } 12 trivial_future()13async fn trivial_future() {} 14 15 struct Connection<H> { 16 _h: H, 17 } 18 complex_future<H>(conn: &Connection<H>)19async 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 main()30fn 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 } 37