Skip to content

Unboxed closure: infer move when passing an unboxed closure to Fn* + Send #18799

Closed
@carllerche

Description

@carllerche

It would be really amazing if in the following snippet, the "move" was inferred by the fact that the closure is passed as a Fn* + Send. Aka, that move was inferred by the Send trait.

fn stuff<F: FnOnce() + Send>(f: F) {
}

pub fn main() {
    stuff(move |:| println!("hello"));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-closuresArea: Closures (`|…| { … }`)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions