Skip to content

'do' and 'for' cannot instantiate polymorphic functions at requisite closure type #3203

Closed
@bblum

Description

@bblum

This compiles:

fn not<T>(_x: T) { }

fn main() {
    not(|| { error!("Hello world"); })
}

This does not (or should I say, it does not do not):

fn not<T>(_x: T) { }

fn main() {
    do not { error!("Hello world"); }
}

I am not sure it ever makes sense to have to do this instantiation except in this particular corner case, so feel free to wontfix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)A-type-systemArea: Type system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions