Skip to content

Invalid suggestion for AsyncFnOnce trait object #134182

Open
@ehuss

Description

Code

#![feature(async_closure)]

pub fn f(x: &dyn AsyncFnOnce()) {}

Current output

error[E0191]: the value of the associated type `CallOnceFuture` in `AsyncFnOnce` must be specified
 --> src/main.rs:3:18
  |
3 | pub fn f(x: &dyn AsyncFnOnce()) {}
  |                  ^^^^^^^^^^^^^ help: specify the associated type: `AsyncFnOnce()<CallOnceFuture = Type>`

Desired output

???

Rationale and extra context

The suggested replacement pub fn f(x: &dyn AsyncFnOnce()<CallOnceFuture = Type>) {} is not valid syntax.

Since dyn Async* is not supported, perhaps it should just say that? I don't know what the plans are here.

Other cases

Rust Version

rustc 1.85.0-nightly (a224f3807 2024-12-09)
binary: rustc
commit-hash: a224f3807e58afc9353510f1d556c607d367545d
commit-date: 2024-12-09
host: aarch64-apple-darwin
release: 1.85.0-nightly
LLVM version: 19.1.5

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-trait-objectsArea: trait objects, vtable layoutF-async_closure`#![feature(async_closure)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions