Lymia / enumset

A library for compact bit sets containing enums.
Apache License 2.0
91 stars 35 forks source link

0.3.13 broke pattern matching #4

Closed webshinra closed 5 years ago

webshinra commented 5 years ago

Hi, updating my depedencies, I just find out that semver seems to be broke between 0.3.12 and 0.3.13.

My set look like:

enum_set_type!{
  pub enum Direction
  {
    #[derive(Debug, Clone, Component, Eq, PartialEq)]
    N, NE, SE, S, SW, NW, UP, DN
  }
}

and are matched like

pub fn ao(e: EnumSet<Direction>) -> &'static str {
const E0:         EnumSet<Direction> = enum_set!(DN | UP | N | NE | SE | S | SW | NW);
match e {
E0 => "/nano-data/textures/ao_cul/ao_DN-UP-N-NE-SE-S-SW-NW.png",
EnumSet{ .. } =>  {
 println!("cannot find {:?}", e ); 
 unreachable!()
}
}
}

It used to work fine, now I get a :

error: to use a constant of type enumset::EnumSet in a pattern, enumset::EnumSet must be annotated with #[derive(PartialEq, Eq)]

Lymia commented 5 years ago

Urgh, okey. I wasn't aware that changing PartialEq/Eq from a derive to a manual impl was a breaking change. I'll see what I can do.

Lymia commented 5 years ago

I have yanked 0.3.13. I will try to figure out how to support this use case properly with a full breaking change.