Skip to content

Bad error with deriving(Eq) #11365

Closed
Closed
@comex

Description

@comex

This code is erroneous because A does not implement Eq:

struct A;
#[deriving(Eq)]
struct B(A);

However, trying to compile it produces two errors, one of which is nonsensical:

/tmp/z.rs:3:10: 3:12 error: mismatched types: expected `&&A` but found `&A` (expected &-ptr but found struct A)
/tmp/z.rs:3 struct B(A);
                     ^~
/tmp/z.rs:2:12: 2:14 note: in expansion of #[deriving(Eq)]
/tmp/z.rs:3:10: 3:12 note: expansion site
/tmp/z.rs:3:10: 3:12 error: failed to find an implementation of trait std::cmp::Eq for A
/tmp/z.rs:3 struct B(A);
                     ^~
/tmp/z.rs:2:12: 2:14 note: in expansion of #[deriving(Eq)]
/tmp/z.rs:3:10: 3:12 note: expansion site
task 'rustc' failed at 'explicit failure', /usr/src/rust/src/libsyntax/diagnostic.rs:41
task '<main>' failed at 'explicit failure', /usr/src/rust/src/librustc/lib.rs:440

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