Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kmcallister opened this issue Aug 7, 2013 · 1 comment
Closed

Comments

@kmcallister
Copy link
Contributor

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.

@alexcrichton
Copy link
Member

Thanks for the report! Closing as a dupe of #7724, however.

flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 7, 2022
…nst, r=xFrednet

Don't warn int-to-char transmutes in const contexts

changelog: Don't warn ``[`transmute_int_to_char`]`` in const contexts

fixes: rust-lang#8379
flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 7, 2022
…ked-in-const, r=flip1995

Suggest from_utf8_unchecked in const contexts

Unfortunately I couldn't figure out how to check whether a given expression is in an `unsafe` context or not, so I just unconditionally emit the wrapping `unsafe {}` block in the suggestion. If there is an easy way to get it to work better then I would love to hear it.

changelog: Suggest `from_utf8_unchecked` instead of `from_utf8` in const contexts for ``[`transmute_bytes_to_str`]``

refs: rust-lang#8379
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants