Skip to content
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

derivative(Eq) doesn't require fields to implement Eq #85

Open
mcarton opened this issue Jan 19, 2021 · 0 comments
Open

derivative(Eq) doesn't require fields to implement Eq #85

mcarton opened this issue Jan 19, 2021 · 0 comments
Labels
bug The crate does not work as expected
Milestone

Comments

@mcarton
Copy link
Owner

mcarton commented Jan 19, 2021

The following compiles but shouldn't because Error is only PartialEq and not Eq:

#[derive(derivative::Derivative)]
#[derivative(PartialEq)]
struct Error;

#[derive(derivative::Derivative)]
#[derivative(PartialEq, Eq)]
struct Struct {
    x: Error,
}

fn main() {}

(Permalink to the playground)

Similarly

#[derive(PartialEq, Eq)]
struct Struct {
    x: f32,
}

shouldn't compile.

rustc enforces this using secret methods: rust-lang/rust#13101

@mcarton mcarton added the bug The crate does not work as expected label Jan 19, 2021
@mcarton mcarton added this to the v3 milestone Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The crate does not work as expected
Projects
None yet
Development

No branches or pull requests

1 participant