You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Closing as a dupe of #7621. This is an unfortunate implementation detail that is required to get #[deriving] to work with types that move; I know approximately how to fix it and have attempted it, but I couldn't get the fix to actually work completely.
`single_match`: fix checking of explicitly matched enums
fixesrust-lang#11365
This approach has false-negatives, but fixing them will require a significant amount of additional state tracking. The comment in `add_and_pats` has the explanation.
changelog: `single_match`: correct checking if the match explicitly matches all of an enum's variants.
This code is erroneous because A does not implement Eq:
However, trying to compile it produces two errors, one of which is nonsensical:
The text was updated successfully, but these errors were encountered: