Skip to content

Conversation

@vpochapuis
Copy link
Contributor

This PR has for goal to implement and resolve #376 as well as #176

Copy link

@mohe2015 mohe2015 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested my crate with the new changes.

@Peternator7 Peternator7 merged commit 1454ced into Peternator7:master Sep 29, 2024
@yescallop
Copy link

I should note that these changes break the following user code:

#[derive(EnumDiscriminants)]
#[strum_discriminants(name(PrivateDiscriminants), vis(pub(self)))]
pub enum PublicEnum {
    Variant0(bool),
    Variant1 { a: bool },
}

The error message is:

error[E0446]: private type `PrivateDiscriminants` in public interface

This is because the IntoDiscriminant impl of PublicEnum leaks the private PrivateDiscriminants type. Should we maybe exclude the IntoDiscriminant impl when the parent enum is public and the generated enum is private?

@Peternator7
Copy link
Owner

fixed in #409

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal to add a trait for EnumDiscriminants

4 participants