Skip to content

Function type does not implement Clone #15444

Closed
@am0d

Description

@am0d

I'm having some troubles with Clone for a function type.
I'm using the following function in my code:

fn(&Request, &mut ResponseWriter) -> Box<Action>

and it apparently doesn't implement Clone, nor can I implement Clone for it.

This is the code that I'm using to test: http://is.gd/3cm94D
and the output I get when trying to compile code which requires the function to be Cloneable:

<anon>:20:5: 20:35 error: failed to find an implementation of trait core::clone::Clone for fn(&Request, &mut ResponseWriter) -> Box<Action>
<anon>:20     routes: Router<RequestHandler>
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: in expansion of #[deriving]
<anon>:18:1: 19:7 note: expansion site

@Kimundi on irc suggested the following code: http://is.gd/WJCznj which works for this specific test case, but requires a lot of other changes in my code that I haven't been to get working yet.

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