-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Using a type
alias on an enum prevents using that enum's variants as the values for other enum variants, with "error: constant evaluation error: unresolved path in constant expression"
#30936
Comments
Encountered this bug when using bindgen. Bindgen produces the following code for a C enum:
|
This also fails when crate boundaries are crossed, see this example crate. |
Not sure how much of a bug this is. |
@arielb1 I understand that |
The confusing thing is that enum variants are not associated items - because of historical reasons we are stuck with - and therefore don't work with |
Possible duplicate of #26264 |
Ah yes, looks to be a dupe of #26264 indeed! |
…, r=nikomatsakis reference.md: clarify the limitation of type alias on an enum Tentatively define the current behavior as the specification. Cf. rust-lang#26264, rust-lang#28556, rust-lang#30936
Here is a program that works just fine:
Here is that same program with a seemingly spurious error:
Error:
The text was updated successfully, but these errors were encountered: