Skip to content

Cannot call call_mut on an unboxed closure with no arguments due to type () not being () #16168

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

Closed
huonw opened this issue Aug 1, 2014 · 0 comments · Fixed by #16637
Closed
Labels
A-closures Area: Closures (`|…| { … }`)

Comments

@huonw
Copy link
Member

huonw commented Aug 1, 2014

#![feature(unboxed_closures)]

use std::ops::FnMut;

fn main() {
    let mut zero = |&mut:| {}; zero.call_mut(());

    // let mut one = |&mut: _: int| {}; one.call_mut((1,));
}
<anon>:6:46: 6:48 error: mismatched types: expected `()` but found `()` (expected tuple but found ())
<anon>:6     let mut zero = |&mut:| {}; zero.call_mut(());
                                                      ^~

Swapping the comments compiles fine.

(At a guess the compiler is looking for a tuple with no fields, which is not the same as unit ().)

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

Successfully merging a pull request may close this issue.

1 participant