Skip to content
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

Can't refer to enum variant via Self keyword #44299

Closed
TheDan64 opened this issue Sep 3, 2017 · 1 comment
Closed

Can't refer to enum variant via Self keyword #44299

TheDan64 opened this issue Sep 3, 2017 · 1 comment

Comments

@TheDan64
Copy link
Contributor

TheDan64 commented Sep 3, 2017

Since this works:

match *self {
    MyEnum::Variant1 => (),
    MyEnum::Variant2 => (),
}

I expected this to work, when in the context of that enum's implementation:

match *self {
    Self::Variant1 => (),
    Self::Variant2 => (),
}

but instead you get the error: error[E0599]: no associated item named `Variant1` found for type `MyEnum` in the current scope which seems to suggest the compiler is indeed looking at MyEnum but is one step away from making the association.

Playpen link

@petrochenkov
Copy link
Contributor

Duplicate of #26264

@petrochenkov petrochenkov marked this as a duplicate of #26264 Sep 3, 2017
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

No branches or pull requests

2 participants