Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
carllerche opened this issue Nov 9, 2014 · 3 comments
Closed
Labels
A-closures Area: Closures (`|…| { … }`)

Comments

@carllerche
Copy link
Member

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"));
}
@carllerche carllerche mentioned this issue Nov 9, 2014
47 tasks
@huonw huonw added the A-closures Area: Closures (`|…| { … }`) label Nov 9, 2014
@huonw
Copy link
Member

huonw commented Jan 25, 2015

It seems this would be better suited by tying to 'static instead of Send; especially given rust-lang/rfcs#458.

@nikomatsakis
Copy link
Contributor

I am not sure whether to implement this inference or not. See thoughts here: http://discuss.rust-lang.org/t/on-the-topic-of-inferring-move-closures/1438

And yes @huonw I've been assuming we would tie it to 'static, not Send.

@nikomatsakis
Copy link
Contributor

Conclusion from the thread was "won't fix".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: Closures (`|…| { … }`)
Projects
None yet
Development

No branches or pull requests

3 participants