diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:29 +0000 |
commit | 631cd5845e8de329d0e227aaa707d7ea228b8f8f (patch) | |
tree | a1b87c8f8cad01cf18f7c5f57a08f102771ed303 /tests/ui/async-await/task-context-arg.rs | |
parent | Adding debian version 1.69.0+dfsg1-1. (diff) | |
download | rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.tar.xz rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.zip |
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/async-await/task-context-arg.rs')
-rw-r--r-- | tests/ui/async-await/task-context-arg.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/async-await/task-context-arg.rs b/tests/ui/async-await/task-context-arg.rs new file mode 100644 index 000000000..937723ca7 --- /dev/null +++ b/tests/ui/async-await/task-context-arg.rs @@ -0,0 +1,25 @@ +// Checks that we don't get conflicting arguments in our debug info with a particular async function +// structure. + +// edition:2021 +// compile-flags: -Cdebuginfo=2 +// build-pass + +#![crate_type = "lib"] + +use std::future::Future; + +// The compiler produces a closure as part of this function. That closure initially takes an +// argument _task_context. Later, when the MIR for that closure is transformed into a generator +// state machine, _task_context is demoted to not be an argument, but just part of an unnamed +// argument. If we emit debug info saying that both _task_context and the unnamed argument are both +// argument number 2, then LLVM will fail with "conflicting debug info for argument". See +// https://github.com/rust-lang/rust/pull/109466#issuecomment-1500879195 for details. +async fn recv_unit() { + std::future::ready(()).await; +} + +pub fn poll_recv() { + // This box is necessary in order to reproduce the problem. + let _: Box<dyn Future<Output = ()>> = Box::new(recv_unit()); +} |