Skip to content

Cannot set bounds for PartialOrd if also deriving Ord #41

@stevenengler

Description

@stevenengler

The following does not build, although I would expect it to.

#[derive(educe::Educe)]
#[educe(
    PartialEq(bound(*)),
    Eq,
    PartialOrd(bound(*)),
    Ord,
)]
pub struct Foo<T>(Option<T>);
error: you are using an incorrect format of the `PartialOrd` attribute, which should be reformatted as follows:
           #[educe(PartialOrd)]
 --> src/lib.rs:5:5
  |
5 |     PartialOrd(bound(*)),

It builds fine if I remove the Ord.

I need to set bound(*) for PartialOrd, otherwise it generates:

impl<T> ::core::cmp::PartialOrd for Foo<T>
where
    Option<T>: ::core::cmp::Ord,
    Self: ::core::cmp::Eq
{ ... }

when I want the bound T: core::cmp::Ord.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions