]>
Commit | Line | Data |
---|---|---|
353b0b11 FG |
1 | // Checks that we don't get conflicting arguments in our debug info with a particular async function |
2 | // structure. | |
3 | ||
c620b35d FG |
4 | //@ edition:2021 |
5 | //@ compile-flags: -Cdebuginfo=2 | |
6 | //@ build-pass | |
353b0b11 FG |
7 | |
8 | #![crate_type = "lib"] | |
9 | ||
10 | use std::future::Future; | |
11 | ||
12 | // The compiler produces a closure as part of this function. That closure initially takes an | |
ed00b5ec | 13 | // argument _task_context. Later, when the MIR for that closure is transformed into a coroutine |
353b0b11 FG |
14 | // state machine, _task_context is demoted to not be an argument, but just part of an unnamed |
15 | // argument. If we emit debug info saying that both _task_context and the unnamed argument are both | |
16 | // argument number 2, then LLVM will fail with "conflicting debug info for argument". See | |
17 | // https://github.com/rust-lang/rust/pull/109466#issuecomment-1500879195 for details. | |
18 | async fn recv_unit() { | |
19 | std::future::ready(()).await; | |
20 | } | |
21 | ||
22 | pub fn poll_recv() { | |
23 | // This box is necessary in order to reproduce the problem. | |
24 | let _: Box<dyn Future<Output = ()>> = Box::new(recv_unit()); | |
25 | } |