Skip to content

Calling method on closure trait object leads to 'source trait is private' error #16600

Closed
@huonw

Description

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

fn main() {
    let task: Box<|: int| -> int> = box |: x| x;
    task.call_once((0i, ));
}
<anon>:5:5: 5:27 error: source trait is private
<anon>:5     task.call_once((0i, ));
             ^~~~~~~~~~~~~~~~~~~~~~

(Adding a use std::ops::FnOnce hits #16599.)

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