Skip to content

Type of closures with the return statement is inferred incorrectly #2547

Closed
@ztlpn

Description

@ztlpn

A spin-off issue of #2534

fn main() {
    let foo = || -> usize {
        return 1;
    };
}

The inferred type of foo is || -> () instead of || -> usize.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions