Skip to content

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

Open
@mcarton

Description

@mcarton

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe crate does not work as expected

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions