about summary refs log tree commit diff
path: root/tests/rustdoc-ui/coverage/enum-tuple.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-12-12 19:00:41 +0100
committerGitHub <noreply@github.com>2024-12-12 19:00:41 +0100
commit2e8807d87ce326ab971264d98489f4c42f5ba560 (patch)
tree097a9b5f95f9b2a2da73862038ff25553a081476 /tests/rustdoc-ui/coverage/enum-tuple.rs
parent8e37e151835d96d6a7415e93e6876561485a3354 (diff)
parent57e8a1c9c3b753f3a96a124149ca1ba07f0db483 (diff)
downloadrust-2e8807d87ce326ab971264d98489f4c42f5ba560.tar.gz
rust-2e8807d87ce326ab971264d98489f4c42f5ba560.zip
Rollup merge of #133122 - compiler-errors:afidt, r=oli-obk
Add unpolished, experimental support for AFIDT (async fn in dyn trait)

This allows us to begin messing around `async fn` in `dyn Trait`. Calling an async fn from a trait object always returns a `dyn* Future<Output = ...>`.

To make it work, Implementations are currently required to return something that can be coerced to a `dyn* Future` (see the example in `tests/ui/async-await/dyn/works.rs`). If it's not the right size, then it'll raise an error at the coercion site (see the example in `tests/ui/async-await/dyn/wrong-size.rs`). Currently the only practical way of doing this is wrapping the body in `Box::pin(async move { .. })`.

This PR does not implement a helper type like a "`Boxing`"[^boxing] adapter, and I'll probably follow-up with another PR to improve the error message for the `PointerLike` trait (something that explains in just normal prose what is happening here, rather than a trait error).
[^boxing]: https://rust-lang.github.io/async-fundamentals-initiative/explainer/user_guide_future.html#the-boxing-adapter

This PR also does not implement new trait solver support for AFIDT; I'll need to think how best to integrate it into candidate assembly, and that's a bit of a matter of taste, but I don't think it will be difficult to do.

This could also be generalized:
* To work on functions that are `-> impl Future` (soon).
* To work on functions that are `-> impl Iterator` and other "dyn rpitit safe" traits. We still need to nail down exactly what is needed for this to be okay (not soon).

Tracking:
* https://github.com/rust-lang/rust/issues/133119
Diffstat (limited to 'tests/rustdoc-ui/coverage/enum-tuple.rs')
0 files changed, 0 insertions, 0 deletions