Skip to content

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

Closed
@huonw

Description

@huonw
#![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 ().)

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