Skip to content

Bad error message when deriving(Clone) is missing Clone for a member #8379

Closed
@kmcallister

Description

@kmcallister

Compiling

#[deriving(Clone)]
enum ImageState {
    Init,
    Prefetching(AfterPrefetch),
    Prefetched(@Cell<~[u8]>),
    Decoding,
    Decoded(@Arc<~Image>),
    Failed
}

enum AfterPrefetch {
    DoDecode,
    DoNotDecode
}

produces

error: mismatched types: expected `image_cache_task::AfterPrefetch` but found `&image_cache_task::AfterPrefetch` (expected enum image_cache_task::AfterPrefetch but found &-ptr)
#[deriving(Clone)]
           ^~~~~

The solution is just to derive Clone on AfterPrefetch as well. But the error message is not helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions