Skip to content

Future from async closure has strange type name. #145606

@theemathas

Description

@theemathas

Code:

fn main() {
    let f = async || {};
    println!("{}", std::any::type_name_of_val(&f()));
}

Output

playground::main::{{closure}}::{{closure}}<i16>

I know that there aren't any guarantees on the exact output format, but having a random <i16> seems rather confusing.

Meta

Reproducible on the playground with version 1.91.0-nightly (2025-08-18 9eb4a2652031ed5ba97c)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-closures`async || {}`A-prettyArea: Pretty printing (including `-Z unpretty`)C-bugCategory: This is a bug.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