Skip to content

non-&mut unboxed closures look for FnMut trait for direct call_once/call method call #16599

Closed
@huonw

Description

@huonw
#![feature(unboxed_closures, unboxed_closure_sugar)]

fn main() {
    let once_ = |: x| x;
    once_.call_once((0i, ));

    let mut_ = |&mut: x| x;
    mut_.call_once((0i, ));
}
<anon>:7:5: 7:28 error: failed to find an implementation of trait core::ops::FnMut<(int),int> for closure
<anon>:7     once_.call_once((0i, ));
             ^~~~~~~~~~~~~~~~~~~~~~~
<anon>:7:5: 7:28 error: failed to find an implementation of trait core::ops::FnMut<(int),int> for closure
<anon>:7     once_.call_once((0i, ));
             ^~~~~~~~~~~~~~~~~~~~~~~

It's particularly strange that the mut_.call_once form works (it's also a little strange that the error message is emitted twice.)

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