]> git.proxmox.com Git - rustc.git/blame - tests/ui/async-await/task-context-arg.rs
New upstream version 1.75.0+dfsg1
[rustc.git] / tests / ui / async-await / task-context-arg.rs
CommitLineData
353b0b11
FG
1// Checks that we don't get conflicting arguments in our debug info with a particular async function
2// structure.
3
4// edition:2021
5// compile-flags: -Cdebuginfo=2
6// build-pass
7
8#![crate_type = "lib"]
9
10use 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.
18async fn recv_unit() {
19 std::future::ready(()).await;
20}
21
22pub 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}