Skip to content

Compilation error with Box<FnOnce(uint) -> uint> #17897

Closed
@carllerche

Description

@carllerche
fn action(cb: Box<FnOnce(uint) -> uint>) -> uint {
    cb(1)
}

pub fn main() {
    println!("num: {}", action(|u| u));
}

output:

$ rustc fnonce.rs
fnonce.rs:1:25: 1:26 error: expected `,`, found `(`
fnonce.rs:1 fn action(cb: Box<FnOnce(uint) -> uint>) -> uint {

/cc @pcwalton

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions