Skip to content

Clone docs say it can't be derived for function pointers but it can #73480

Closed
@martin-t

Description

@martin-t

The text is here:

An example is a generic struct holding a function pointer. In this case, the implementation of Clone cannot be derived, but can be implemented as:

...

However, it's in fact possible to derive:

#[derive(Clone)]
struct Generate<T>(fn() -> T);

(playground)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions